EasingAnimation

本文介绍了一个用于缓动动画的类EasingAnimation,并提供了详细的使用指南。通过简单的代码示例展示了如何创建关键帧动画并实现弹性缓动效果。

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 :)

 

转载于:https://www.cnblogs.com/YouXianMing/p/4229834.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值