标签:
1 //设置旋转 2 let rotationAnimation:CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z") 3 //rotationAnimation.toValue = CGFloat(M_PI_2) * rotateCount 4 rotationAnimation.fromValue = CGFloat(M_PI_2) * rotateCount 5 rotationAnimation.toValue = CGFloat(M_PI_2) * (++rotateCount) 6 rotationAnimation.removedOnCompletion = false 7 rotationAnimation.fillMode = kCAFillModeForwards 8 //设置缩放 9 let scaleAnimation:CABasicAnimation = CABasicAnimation(keyPath: "transform.scale") 10 if self.rotateCount % 2 == 1 { 11 scaleAnimation.fromValue = 1.0 12 scaleAnimation.toValue = 0.75 13 scaleAnimation.duration = 1.0;
14 scaleAnimation.removedOnCompletion = false 15 scaleAnimation.fillMode = kCAFillModeForwards
//设置 动画不回到起始位置,这两个要一起设置。
16 } 17 //设置动画组 18 let animationGroup:CAAnimationGroup = CAAnimationGroup() 19 animationGroup.duration = 1.0 20 animationGroup.repeatCount = 0 21 animationGroup.animations = [rotationAnimation,scaleAnimation] 22 animationGroup.removedOnCompletion = false 23 animationGroup.fillMode = kCAFillModeForwards 24 //组编动画 25 self.VIDEO.playerLayer.addAnimation(animationGroup, forKey: "animationGroup")
CALayer CABasicAnimation 组动画的设置,设置动画不回到初始位置
标签:
原文地址:http://www.cnblogs.com/741162830qq/p/4935586.html