UIView+GlowView.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // UIView+GlowView.h
  3. // GlowView
  4. //
  5. // Created by YouXianMing on 15/7/4.
  6. // Copyright (c) 2015年 YouXianMing. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @interface UIView (GlowView)
  10. //
  11. // == 动画时间解析 ==
  12. //
  13. // 0.0 ------------- 0.0 ------------> glowOpacity [-------------] glowOpacity ------------> 0.0
  14. // T T T T
  15. // | | | |
  16. // | | | |
  17. // . . . .
  18. // hideDuration glowAnimationDuration glowDuration glowAnimationDuration
  19. //
  20. #pragma mark - 设置辉光效果
  21. /**
  22. * 辉光的颜色
  23. */
  24. @property (nonatomic, strong) UIColor *glowColor;
  25. /**
  26. * 辉光的透明度
  27. */
  28. @property (nonatomic, strong) NSNumber *glowOpacity;
  29. /**
  30. * 辉光的阴影半径
  31. */
  32. @property (nonatomic, strong) NSNumber *glowRadius;
  33. #pragma mark - 设置辉光时间间隔
  34. /**
  35. * 一次完整的辉光周期(从显示到透明或者从透明到显示),默认1s
  36. */
  37. @property (nonatomic, strong) NSNumber *glowAnimationDuration;
  38. /**
  39. * 保持辉光时间(不设置,默认为0.5s)
  40. */
  41. @property (nonatomic, strong) NSNumber *glowDuration;
  42. /**
  43. * 不显示辉光的周期(不设置默认为0.5s)
  44. */
  45. @property (nonatomic, strong) NSNumber *hideDuration;
  46. #pragma mark - 辉光相关操作
  47. /**
  48. * 创建出辉光layer
  49. */
  50. - (void)createGlowLayer;
  51. /**
  52. * 插入辉光的layer
  53. */
  54. - (void)insertGlowLayer;
  55. /**
  56. * 移除辉光的layer
  57. */
  58. - (void)removeGlowLayer;
  59. /**
  60. * 显示辉光
  61. */
  62. - (void)glowToshowAnimated:(BOOL)animated;
  63. /**
  64. * 隐藏辉光
  65. */
  66. - (void)glowToHideAnimated:(BOOL)animated;
  67. /**
  68. * 开始循环辉光
  69. */
  70. - (void)startGlowLoop;
  71. @end