SVGAPlayer.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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)svgaPlayerDidAnimatedToFrame:(NSInteger)frame;
  14. - (void)svgaPlayerDidAnimatedToPercentage:(CGFloat)percentage;
  15. @end
  16. typedef void(^SVGAPlayerDynamicDrawingBlock)(CALayer *contentLayer, NSInteger frameIndex);
  17. @interface SVGAPlayer : UIView
  18. @property (nonatomic, weak) id<SVGAPlayerDelegate> delegate;
  19. @property (nonatomic, strong) SVGAVideoEntity *videoItem;
  20. @property (nonatomic, assign) IBInspectable int loops;
  21. @property (nonatomic, assign) IBInspectable BOOL clearsAfterStop;
  22. @property (nonatomic, copy) NSString *fillMode;
  23. - (void)startAnimation;
  24. - (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse;
  25. - (void)pauseAnimation;
  26. - (void)stopAnimation;
  27. - (void)clear;
  28. - (void)stepToFrame:(NSInteger)frame andPlay:(BOOL)andPlay;
  29. - (void)stepToPercentage:(CGFloat)percentage andPlay:(BOOL)andPlay;
  30. #pragma mark - Dynamic Object
  31. - (void)setImage:(UIImage *)image forKey:(NSString *)aKey;
  32. - (void)setImageWithURL:(NSURL *)URL forKey:(NSString *)aKey;
  33. - (void)setImage:(UIImage *)image forKey:(NSString *)aKey referenceLayer:(CALayer *)referenceLayer; // deprecated from 2.0.1
  34. - (void)setAttributedText:(NSAttributedString *)attributedText forKey:(NSString *)aKey;
  35. - (void)setDrawingBlock:(SVGAPlayerDynamicDrawingBlock)drawingBlock forKey:(NSString *)aKey;
  36. - (void)setHidden:(BOOL)hidden forKey:(NSString *)aKey;
  37. - (void)clearDynamicObjects;
  38. @end