码迷,mamicode.com
首页 > 其他好文 > 详细

CALayer CABasicAnimation 组动画的设置,设置动画不回到初始位置

时间:2015-11-04 13:18:21      阅读:760      评论:0      收藏:0      [点我收藏+]

标签:

 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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!