CABasicAnimation scale 多个动画顺序执行

CAMediaTimingFunction自定义动画曲线

CAMediaTimingFunction.init(controlPoints: 0.63, 0.34, 1, 0.3)

//通过开始时间顺序执行

 let caani = CABasicAnimation.init(keyPath: "transform.scale")
            caani.fromValue = 0
            caani.toValue = 1.03
            caani.timingFunction = CAMediaTimingFunction.init(name: .linear)//init(controlPoints: 0.63, 0.34, 1, 0.3)
            caani.duration = 1
            self.v1.layer.add(caani, forKey: nil)
            
            let caani2 = CABasicAnimation.init(keyPath: "transform.scale")
            caani2.beginTime = CACurrentMediaTime() + 1//通过开始时间顺序执行
            caani2.fromValue = 1.03
            caani2.toValue = 1
            caani2.timingFunction = CAMediaTimingFunction.init(name: .easeOut)
            caani2.duration = 0.4
            self.v1.layer.add(caani2, forKey: nil)

动画曲线参数工具:

https://github.com/YouXianMing/Tween-o-Matic-CN

你可能感兴趣的:(CABasicAnimation scale 多个动画顺序执行)