SVGAPlayer.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // SVGAPlayer.h
  3. // SVGAPlayer
  4. //
  5. // Created by 崔明辉 on 16/6/17.
  6. // Copyright © 2016年 UED Center. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @class SVGAVideoEntity, SVGAPlayer;
  10. @protocol SVGAPlayerDelegate <NSObject>
  11. @optional
  12. - (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player;
  13. - (void)svgaPlayer:(SVGAPlayer *)player didAnimatedToFrame:(NSInteger)frame;
  14. - (void)svgaPlayer:(SVGAPlayer *)player didAnimatedToPercentage:(CGFloat)percentage;
  15. - (void)svgaPlayerDidAnimatedToFrame:(NSInteger)frame API_DEPRECATED("Use svgaPlayer:didAnimatedToFrame: instead", ios(7.0, API_TO_BE_DEPRECATED));
  16. - (void)svgaPlayerDidAnimatedToPercentage:(CGFloat)percentage API_DEPRECATED("Use svgaPlayer:didAnimatedToPercentage: instead", ios(7.0, API_TO_BE_DEPRECATED));
  17. @end
  18. typedef void(^SVGAPlayerDynamicDrawingBlock)(CALayer *contentLayer, NSInteger frameIndex);
  19. @interface SVGAPlayer : UIView
  20. @property (nonatomic, weak) id<SVGAPlayerDelegate> delegate;
  21. @property (nonatomic, strong) SVGAVideoEntity *videoItem;
  22. @property (nonatomic, assign) IBInspectable int loops;
  23. @property (nonatomic, assign) IBInspectable BOOL clearsAfterStop;
  24. @property (nonatomic, copy) NSString *fillMode;
  25. @property (nonatomic, copy) NSRunLoopMode mainRunLoopMode;
  26. - (void)startAnimation;
  27. - (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse;
  28. - (void)pauseAnimation;
  29. - (void)stopAnimation;
  30. - (void)clear;
  31. - (void)stepToFrame:(NSInteger)frame andPlay:(BOOL)andPlay;
  32. - (void)stepToPercentage:(CGFloat)percentage andPlay:(BOOL)andPlay;
  33. - (void)clearVideoItem:(NSString *)cacheKey;
  34. + (void)clearVideoItem:(NSString *)cacheKey;
  35. #pragma mark - Dynamic Object
  36. - (void)setImage:(UIImage *)image forKey:(NSString *)aKey;
  37. - (void)setImageWithURL:(NSURL *)URL forKey:(NSString *)aKey;
  38. - (void)setImage:(UIImage *)image forKey:(NSString *)aKey referenceLayer:(CALayer *)referenceLayer; // deprecated from 2.0.1
  39. - (void)setAttributedText:(NSAttributedString *)attributedText forKey:(NSString *)aKey;
  40. - (void)setDrawingBlock:(SVGAPlayerDynamicDrawingBlock)drawingBlock forKey:(NSString *)aKey;
  41. - (void)setHidden:(BOOL)hidden forKey:(NSString *)aKey;
  42. - (void)clearDynamicObjects;
  43. @end