私はこのようなものを持っています:
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"];
このアニメーションは 3.35 秒続きます。その間、たとえば 2 秒で、同じキー @"theAnimation" を持つ新しいアニメーションが異なる値で開始されることがあります。
何が起こっているのか問題: 新しいアニメーションが現在表示されている状態を取得しません。それはゼロから一生懸命始まります。ビューは醜い方法で開始位置にジャンプし、そこから新しいアニメーションが始まります。UIView には setAnimationsBeginFromCurrentState=YES がありますが、CAKeyFrameAnimation のようなものは見つかりませんでした。何か案が?