CAKeyframeAnimation をキーフレーム値の代わりにパスで使用して、(位置以外の) プロパティをアニメーション化できますか? キーコードは次のとおりです。
CAKeyframeAnimation *theLeftGradientAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
theLeftGradientAnimation.removedOnCompletion = NO;
theLeftGradientAnimation.fillMode = kCAFillModeForwards;
theLeftGradientAnimation.duration = (isToClose ? self.fromDuration : self.toDuration);
//test with a linear monotonic path to define the opacity function response
UIBezierPath *shadePath = [UIBezierPath bezierPath];
[shadePath moveToPoint:CGPointMake(0.0f, 0.0)]; //ASSUME coords are: x->t y->alpha(t)
[shadePath addLineToPoint:CGPointMake(1.0f, 1.0f)]; //ASSUME time normalized to duration
[shadePath closePath];
theLeftGradientAnimation.path = shadePath.CGPath;
ただし、これは適切に機能しません。不透明度はスムーズにアニメーション化されますが、パスの変更に応じて単調または正確ではありません (イージングのようにパスが (0.0,0.0) から (1.0,1.0) に「正規化」されていると仮定します)。関数)。位置をアニメーション化したり、パス上でレイヤーを移動したりしているわけではありませんが、アニメーション化可能なプロパティに使用したいと考えています。
ドキュメントにはあいまいさがあり、パスを使用してアニメーション時間とアニメーション化されるプロパティの伝達関数を効果的に定義できることが示唆されています (したがって、その伝達関数に基づいて作成されるキーフレーム値の配列の代わりになります)。 . また、「キーフレームのタイミングとペーシングの拡張機能」の iOS 6 ドキュメントでは、パスと値の使用を明確にしようとしていますが、まだあいまいです。