CAAnimation 动画之循环转动
2018-01-04 本文已影响0人
willokyes
CAAnimation 之属性 isRemovedOnCompletion 要设置为 false ,才能不停地循环转动
/* When true, the animation is removed from the render tree once its
* active duration has passed. Defaults to YES. */
open var isRemovedOnCompletion: Bool
func startAnimation() {
let anim = CABasicAnimation(keyPath: "transform.rotation")
anim.toValue = 2 * Double.pi
anim.repeatCount = Float.greatestFiniteMagnitude
anim.duration = 10
anim.isRemovedOnCompletion = false
someView.layer.add(anim, forKey: nil)
}