XYLabelAnimation.h 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // XYLabelAnimation.h
  3. // Starbuds
  4. //
  5. // Created by 翟玉磊 on 2020/3/11.
  6. // Copyright © 2020 翟玉磊. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. typedef enum {
  11. XYLabelAnimationTypeNormal = 0,
  12. XYLabelAnimationTypeWave = 1
  13. }XYLabelAnimationType;
  14. @interface XYLabelAnimation : UILabel
  15. @property (nonatomic, copy) NSString *text;
  16. @property (nonatomic, copy) NSAttributedString *attributedText;
  17. @property (nonatomic, assign) XYLabelAnimationType type;
  18. /// 动画高度
  19. @property (nonatomic, assign) CGFloat animationHeight;
  20. /// label文字跳动速度 1~10 默认2
  21. @property (nonatomic, assign) NSUInteger rate;
  22. /// 文字之间的间距
  23. @property (nonatomic, assign) CGFloat kerning;
  24. - (instancetype)initWithFrame:(CGRect)frame text:(NSString *)text;
  25. - (instancetype)initWithFrame:(CGRect)frame attributedText:(NSAttributedString *)attributedText;
  26. - (void)startAnimation;
  27. - (void)pauseAnimation;
  28. - (void)stopAnimation;
  29. @end
  30. NS_ASSUME_NONNULL_END