File tree Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 11
22Pod ::Spec . new do |s |
33 s . name = "SVGAPlayer"
4- s . version = "2.5.5 "
4+ s . version = "2.5.6 "
55 s . summary = "SVGAPlayer 是一个高性能的动画播放器"
66 s . description = <<-DESC
77 SVGA 是一种全新的动画格式,由 YY UED 团队主导开发;
Original file line number Diff line number Diff line change @@ -67,12 +67,13 @@ - (IBAction)onChange:(id)sender {
6767 NSParagraphStyleAttributeName : para,
6868 }];
6969 [self .aPlayer setAttributedText: str forKey: @" banner" ];
70-
71- // self.aPlayer.mianRunLoopMode = NSDefaultRunLoopMode;
70+
7271 [self .aPlayer startAnimation ];
72+
73+ // [self.aPlayer startAnimationWithRange:NSMakeRange(10, 25) reverse:YES];
7374 }
7475 } failureBlock: nil ];
75-
76+ //
7677// [parser parseWithURL:[NSURL URLWithString:@"https://github.com/svga/SVGA-Samples/raw/master_aep/BitmapColorArea1.svga"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
7778// if (videoItem != nil) {
7879// self.aPlayer.videoItem = videoItem;
Original file line number Diff line number Diff line change @@ -89,6 +89,19 @@ - (void)startAnimation {
8989}
9090
9191- (void )startAnimationWithRange : (NSRange )range reverse : (BOOL )reverse {
92+ if (self.videoItem == nil ) {
93+ NSLog (@" videoItem could not be nil!" );
94+ return ;
95+ } else if (self.drawLayer == nil ) {
96+ self.videoItem = _videoItem;
97+ }
98+ [self stopAnimation: NO ];
99+ self.loopCount = 0 ;
100+ if (self.videoItem .FPS == 0 ) {
101+ NSLog (@" videoItem FPS could not be 0!" );
102+ return ;
103+ }
104+
92105 self.currentRange = range;
93106 self.reversing = reverse;
94107 if (reverse) {
@@ -97,7 +110,10 @@ - (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse {
97110 else {
98111 self.currentFrame = MAX (0 , range.location );
99112 }
100- [self startAnimation ];
113+ self.forwardAnimating = !self.reversing ;
114+ self.displayLink = [CADisplayLink displayLinkWithTarget: self selector: @selector (next )];
115+ self.displayLink .frameInterval = 60 / self.videoItem .FPS ;
116+ [self .displayLink addToRunLoop: [NSRunLoop mainRunLoop ] forMode: self .mainRunLoopMode];
101117}
102118
103119- (void )pauseAnimation {
You can’t perform that action at this time.
0 commit comments