I have one like this:
CALayer *layer = stripeButton.layer;
CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"bounds.origin.y"];
moveAnim.duration = 3.35;
moveAnim.repeatCount = 0;
moveAnim.autoreverses = NO;
moveAnim.removedOnCompletion = NO;
moveAnim.calculationMode = kCAAnimationLinear;
moveAnim.fillMode = kCAFillModeForwards;
// ... keys and values here ...
[theLayer addAnimation:moveAnim forKey:@"theAnimation"];
You see this animation goes 3.35 seconds. In the meantime, it can happen that at i.e. 2 seconds a new animation with the same key @"theAnimation" is kicked off, for different values.
Problem what's happening: New animation does not pick up the current visible state. It begins hard from scratch. The view jumps to start position in a ugly manner and from there, the new animation begins. For UIView there is an setAnimationsBeginFromCurrentState=YES, but I haven't found anything like that for CAKeyFrameAnimation. Any idea?