iOS:springWithDamping就像KeyFrame动画的动画一样

时间:2015-04-28 16:56:43

标签: ios swift animation uianimation

我使用UIView.animateWithDuration(...usingSpringWithDamping:...)完成了以下自定义转换。

UIView.animateWithDuration(self.transitionDuration(transitionContext),
    delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 1.0,
    options: nil, animations: {() in
    // ...
}, completion: {(Bool) in
    // ...
})

但是我必须使用UIViewControllerInteractiveTransitioning扩展我的自定义转换,以便进行交互式转换,用户可以再次向下滑动模式视图。

因此,我需要动画的关键帧,以便UIPercentDrivenInteractiveTransition正常工作。

所以我改变了动画功能以使用UIView.animateWithKeyframes...

UIView.animateKeyframesWithDuration(self.transitionDuration(transitionContext),
    delay: 0.0, options: UIViewKeyframeAnimationOptions.CalculationModeCubic,
    animations: {() in
    // ...
}, completion: {(Bool) in
    // ...
})

我现在的问题:我丢失了弹簧动画。

我查了几个链接,其中最有希望的是:

...但是使用.addKeyframes...方法我无法指定我需要的完成块。

有什么建议吗? : - /

0 个答案:

没有答案