Egret之自定义Tween缓动动画函数
文章目录
/**
* 自定义Tween动画类
*/
namespace TweenPro
{
export class Ease
{
constructor(){};
/**
* asine out
* 缓动动画函数:先较快,后较慢,再较快
* @param t[0,1]
*/
static asinOut(t:number):number
{
//反正弦函数
return (Math.asin(0.96*2*t-1)+Math.PI/2)/Math.PI;
}
/**
* circOutTocircIn
* 缓动动画函数:先很快,后很慢,再很快
* @param t[0,1]
*/
static circOutToIn(t:number):number
{
if(t<=0.5)
{
return Math.sqrt(1 - (--t*2) * t*2);
}
else
{
return -(Math.sqrt(1 - 4*t * t) - 1);
}
}
}
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论