首页 > 其他 > 详细

EasingAnimation

时间:2015-01-16 22:11:03      阅读:362      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!