Reputation: 41845
A code snippet from https://github.com/danielamitay/DACircularProgress/blob/master/DACircularProgress/DACircularProgressView.m
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"progress"];
animation.duration = duration;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.fillMode = kCAFillModeForwards;
animation.fromValue = [NSNumber numberWithFloat:self.progress];
animation.toValue = [NSNumber numberWithFloat:pinnedProgress];
animation.beginTime = CACurrentMediaTime() + initialDelay;
animation.delegate = self;
[self.circularProgressLayer addAnimation:animation forKey:@"progress"];
But I could not find progress
in the offical document. Does the keypath need to be animatable property? What does the progress
mean?
Upvotes: 1
Views: 160
Reputation: 32066
From this answer (which is coincidentally animating progress
too):
Firstly we need to create a new subclass of CALayer that has an animatable property called 'progress'.
Your snippet does indeed have a property called 'progress'
@property(nonatomic) CGFloat progress;
It appears the animation is animating that property
Upvotes: 2
Reputation: 41845
It is because the progress
is an animatable property for this specific uiview. We could custom animatable property refer: Create a custom animatable property
Upvotes: 0