弹性动画方法animateWithDuration: delay: usingSpringWithDamping: initialSpringVelocity: options: animations

本文介绍了iOS动画中阻尼系数(dampingRatio)与弹性速率(velocity)的概念及应用。通过生动的比喻帮助理解这两个参数如何影响动画效果,并提供了官方文档的解释。

这个动画效果是从IOS7开始有的,个人觉得动画效果的用户体验很好,用起来也方便,但是这里面的dampingRatio和velocity涉及到物理力学的知识,比较难理解和计算,只能通过Demo试验来理解它所代表的意思。通过形象生动的比喻来理解它。

这里写图片描述

附上原英文文档解释
/* Performs animations using a timing curve described by the motion of a spring. When dampingRatio is 1, the animation will smoothly decelerate to its final model values without oscillating. Damping ratios less than 1 will oscillate more and more before coming to a complete stop. You can use the initial spring velocity to specify how fast the object at the end of the simulated spring was moving before it was attached. It’s a unit coordinate system, where 1 is defined as travelling the total animation distance in a second. So if you’re changing an object’s position by 200pt in this animation, and you want the animation to behave as if the object was moving at 100pt/s before the animation started, you’d pass 0.5. You’ll typically want to pass 0 for the velocity. */

其他参数不再介绍
dampingRatio(阻尼系数)
范围 0~1 当它设置为1时,动画是平滑的没有振动的达到静止状态,越接近0 振动越大

velocity (弹性速率)
就是形变的速度,从视觉上看可以理解弹簧的形变速度,到动画结束,该速度减为0,所以,velocity速度越大,那么形变会越快,当然在同等时间内,速度的变化(就是速率)也会越快,因为速度最后都要到0。

如果不明白可以自己手写Demo进行比较

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值