0

Possible Duplicate:
Objective-C - CABasicAnimation applying changes after animation?

Using the following code, I'm animating the drawing of a circle:

CAShapeLayer circle = [CAShapeLayer layer];
circle.strokeEnd = 0;
...
[self.view.layer addSublayer:circle];

CABasicAnimation *drawAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
drawAnimation.beginTime = CACurrentMediaTime() + 3;
drawAnimation.duration = 1.0;
drawAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
drawAnimation.toValue = [NSNumber numberWithFloat:1.0f];
drawAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
drawAnimation.removedOnCompletion = NO;
drawAnimation.fillMode  = kCAFillModeForwards;
[circle addAnimation:drawAnimation forKey:@"drawShape"];

Whilst this draws fine, it seems circle.strokeEnd isn't actually updated to 1. How can I do this?

Community
  • 1
  • 1
Jonathan
  • 13,947
  • 17
  • 94
  • 123
  • …and [Animating CAGradientLayer's locations property in a UIScrollView mask resets after completion](http://stackoverflow.com/questions/11068631/animating-cagradientlayers-locations-property-in-a-uiscrollview-mask-resets-aft) – rob mayoff Nov 14 '12 at 19:24
  • …and [Animation of stroke of circle segment ends in complete stroke](http://stackoverflow.com/questions/9142888/animation-of-stroke-of-circle-segment-ends-in-complete-stroke) – rob mayoff Nov 14 '12 at 19:25

0 Answers0