我的代码如下。动画停止时如何减慢速度?

extension UIView{
    func rotate() {
        let rotation : CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
        rotation.fromValue = 0.0
        rotation.toValue = 25
        rotation.duration = 1.5
        rotation.isCumulative = true
        rotation.repeatCount = 1
        self.layer.add(rotation, forKey: "rotationAnimation")
    }
}

最佳答案

请找到以下详细信息并在您的代码中添加以下行,

rotation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)



希望这对您有所帮助,如有任何疑问,请告诉我。

关于ios - 动画停止时如何使动画速度变慢,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50226660/

10-09 08:36