Hi,
I'm trying to animate a layer's position. It animates, but it's frame property is not updated at the end of the animation, it seems only its presentationLayer is. Here's what I'm doing:
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint (path, NULL, layer.frame.origin.x, layer.frame.origin.y);
CGPathAddLineToPoint(path, NULL, 20, 20);
CGPathAddLineToPoint(path, NULL, 20, 460);
CGPathAddLineToPoint(path, NULL, 300, 460);
CAKeyframeAnimation* animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
animation.path = path;
animation.calculationMode = kCAAnimationPaced;
animation.repeatCount = 0;
animation.autoreverses = NO;
CAAnimationGroup *theGroup = [CAAnimationGroup animation];
theGroup.animations = [NSArray arrayWithObject:animation];
theGroup.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
theGroup.duration = 2;
theGroup.removedOnCompletion = NO;
theGroup.fillMode = kCAFillModeForwards;
CFRelease(path);
[layer addAnimation:theGroup forKey:@"animatePosition"];
After the animation completes, the layer is sitting at its correct destination, but when I query its frame value, it says it's still at its original location! When/where/how are we supposed to bring the frame property in sync with the presentationLayer frame property of the layer?
Thanks