分享几个比较有用的脚本ease in/out效果的脚本
ease_linear
/// @function ease_linear(time, start, change, duration) /// @param time /// @param start /// @param change /// @param duation var t = argument[0]; //time var b = argument[1]; //begin(start) var c = argument[2]; //change var d = argument[3]; //duration t /= d; return c*t + b;
ease_in
/// @function ease_in(time, start, change, duration) /// @param time /// @param start /// @param change /// @param duation var t = argument[0]; //time var b = argument[1]; //begin(start) var c = argument[2]; //change var d = argument[3]; //duration t /= d; return c*t*t*t + b;
ease_in_out
/// @function ease_in_out(time, start, change, duration) /// @param time /// @param start /// @param change /// @param duation var t = argument[0]; //time var b = argument[1]; //begin(start) var c = argument[2]; //change var d = argument[3]; //duration t /= d/2; if (t < 1) return c/2*t*t + b; t--; return -c/2 * (t*(t-2)-1) + b;
ease_out_elastic
var t = argument[0]; //time var b = argument[1]; //begin(start) var c = argument[2]; //change var d = argument[3]; //duration var s = 1.7; var p = 0; var a = c; if (t==0) return b; t/=d; if (t==1) return b+c; if (!p) p=d*0.4; //effect bounce if (a<abs(c)) { a=c; s=p/4; } else { s=p/(2*pi)*arcsin(c/a); } return a*power(2,-10*t)*sin((t*d-s)*(2*pi)/p)+c+b;
实际效果如下
试验了一下配合的效果
12/31/2018
H
高产点赞。
@流贾君:共勉~