2016-12-16 4 views
1

UIViewPropertyAnimatorでドブリングした後、私は、.isReversedが逆のムービーのように単にアニメーションを後方に再生することがわかりました。逆の場合にのみアニメーションに適用されるカスタムキュービックタイミングパラメータを使用して、逆のアニメーションに「弾力性」を適用することは可能ですか?UISpringTimingParametersに逆スプリング効果がありますか?

答えて

1

アニメーションを逆にして、スプリング効果で戻りたいときは、単純に次のコードスニペットを使用することができます。

// prepare new timing parameters with the desired springiness 
let newTimingParameters 
    = UISpringTimingParameters(dampingRatio: 0.5, initialVelocity: CGVector(dx: 2, dy: 0)) 

// pause the animator 
propertyAnimator.pauseAnimation() 

// reverse it 
propertyAnimator.isReversed = true 

// and restart it using new timing parameters with springiness 
propertyAnimator.continueAnimation(withTimingParameters: newTimingParameters, durationFactor: propertyAnimator.fractionComplete) 
関連する問題