This repository was archived by the owner on Feb 6, 2023. It is now read-only.
File tree 3 files changed +22
-5
lines changed
3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 1
1
2
2
Pod ::Spec . new do |s |
3
3
s . name = "SVGAPlayer"
4
- s . version = "2.5.5 "
4
+ s . version = "2.5.6 "
5
5
s . summary = "SVGAPlayer 是一个高性能的动画播放器"
6
6
s . description = <<-DESC
7
7
SVGA 是一种全新的动画格式,由 YY UED 团队主导开发;
Original file line number Diff line number Diff line change @@ -67,12 +67,13 @@ - (IBAction)onChange:(id)sender {
67
67
NSParagraphStyleAttributeName : para,
68
68
}];
69
69
[self .aPlayer setAttributedText: str forKey: @" banner" ];
70
-
71
- // self.aPlayer.mianRunLoopMode = NSDefaultRunLoopMode;
70
+
72
71
[self .aPlayer startAnimation ];
72
+
73
+ // [self.aPlayer startAnimationWithRange:NSMakeRange(10, 25) reverse:YES];
73
74
}
74
75
} failureBlock: nil ];
75
-
76
+ //
76
77
// [parser parseWithURL:[NSURL URLWithString:@"https://github.com/svga/SVGA-Samples/raw/master_aep/BitmapColorArea1.svga"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
77
78
// if (videoItem != nil) {
78
79
// self.aPlayer.videoItem = videoItem;
Original file line number Diff line number Diff line change @@ -89,6 +89,19 @@ - (void)startAnimation {
89
89
}
90
90
91
91
- (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
+
92
105
self.currentRange = range;
93
106
self.reversing = reverse;
94
107
if (reverse) {
@@ -97,7 +110,10 @@ - (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse {
97
110
else {
98
111
self.currentFrame = MAX (0 , range.location );
99
112
}
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];
101
117
}
102
118
103
119
- (void )pauseAnimation {
You can’t perform that action at this time.
0 commit comments