距離の異なるパスを移動するオブジェクトが複数あります。すべてのオブジェクトの速度を同じにするにはどうすればよいですか?
CAKeyframeAnimation * pathAnimation = [CAKeyframeAnimation AnimationWithKeyPath:@ "position"]; pathAnimation.speed = 0.5;
動作しません;(
距離が大きいほど速度が上がります。
距離の異なるパスを移動するオブジェクトが複数あります。すべてのオブジェクトの速度を同じにするにはどうすればよいですか?
CAKeyframeAnimation * pathAnimation = [CAKeyframeAnimation AnimationWithKeyPath:@ "position"]; pathAnimation.speed = 0.5;
動作しません;(
距離が大きいほど速度が上がります。
私はこのアイデアをテストしていませんが、速度は相対値として定義されているようです。
パスの長さを計算できる場合は、それをピクセル相対値に再計算できます。アニメーションの速度は、 baseSpeedInPixelsが目的の基本速度定数になるanimation.speed = baseSpeedInPixels / thisPathLengthInPixels;
場所になります。
1.0より大きい値になる可能性があります。アニメーションクラスがこれを理解しない場合は、タイミング値を再マップして、速度を[0,1]の範囲に保つことができます。