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

EasingAnimation

时间:2015-01-16 22:12:52      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:

EasingAnimation

技术分享

https://github.com/YouXianMing/EasingAnimation

This class is used for Easing animation.

  • Easy to understand
  • You can use it to build your own animation

 

How to use

  • Import the header

    and use like this:

 // 计算好起始值,结束值
 CGFloat oldValue = 0.f;
 CGFloat newValue = 1.f;

 // 关键帧动画
 CAKeyframeAnimation *animation =      [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];

 // 设置值
 [animation setValues:[YXEasing calculateFrameFromValue:oldValue
              toValue:newValue
                 func:ElasticEaseOut
           frameCount:500]];

 // 设置持续时间
 animation.duration  = 0.5f;

 // 每秒增加的角度(设定结果值,在提交动画之前执行)
 layer.transform =      CATransform3DMakeRotation(newValue, 0.0, 0.0, 1.0);

 // 提交动画
 [layer addAnimation:animation forKey:nil];

enjoy it :)

 

EasingAnimation

标签:

原文地址:http://www.cnblogs.com/YouXianMing/p/4229834.html

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