次のサンプル コードを使用して (連続回転) を回転させていUIImageView
ます。
CAKeyframeAnimation *theAnimation = [CAKeyframeAnimation animation];
theAnimation.values = [NSArray arrayWithObjects:
[NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0,0,1)],
[NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI, 0,0,1)],
[NSValue valueWithCATransform3D:CATransform3DMakeRotation(2*M_PI, 0,0,1)],
nil];
theAnimation.cumulative = YES;
theAnimation.duration = duration;
theAnimation.repeatCount = HUGE_VALF;
theAnimation.removedOnCompletion = YES;
[self.layer addAnimation:theAnimation forKey:@"transform"];
アニメーションが表示されている間に、回転の速度を変更したい(異なる期間を意味する)。最も簡単な方法は、アニメーションを停止して新しいアニメーションを作成することです。これを行う際の問題は、新しいアニメーションが 0 度から開始され、回転するビューの速度が変化したときに見苦しいジャンプが発生することです。
アニメーションを中断せずにアニメーションの長さを変更するにはどうすればよいですか?