1

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?

James Webster
  • 31,482
  • 11
  • 68
  • 114
Jichao
  • 38,362
  • 43
  • 118
  • 192

2 Answers2

2

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

Community
  • 1
  • 1
James Webster
  • 31,482
  • 11
  • 68
  • 114
0

It is because the progress is an animatable property for this specific uiview. We could custom animatable property refer: Create a custom animatable property

Community
  • 1
  • 1
Jichao
  • 38,362
  • 43
  • 118
  • 192