We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c8ac841 commit d5cb8e4Copy full SHA for d5cb8e4
1 file changed
AXAnimationChain/Classes/CoreAnimation/CAAnimation+ImmediateValue.m
@@ -84,11 +84,13 @@ - (id)immediateValueAtTime:(CFTimeInterval)time {
84
#endif
85
@implementation CAKeyframeAnimation (ImmediateValue)
86
- (id)immediateValueAtTime:(CFTimeInterval)time {
87
+ if (time >= self.duration) return self.values.lastObject;
88
+
89
NSUInteger allFramesCount = self.values.count;
90
CGFloat pt = time/self.duration;
91
92
NSUInteger index = ceil(pt * allFramesCount);
- if (index > self.values.count-1) return nil;
93
+ if (index > self.values.count-1) return self.values.lastObject;
94
95
id value = self.values[index];
96
return value;
0 commit comments