- function UIUtil.EaseOut(t,b,c,d)
- if t> d then
- t = d
- end
- local x = t/d;
return b + (c - b) * (1-(x -1)^ 2) -- 偶数幂用上面这个
-- return b + (c - b) * (1 - (1 - x)^ 3) -- 奇数幂用下面这个
- end
- function UIUtil.EaseInOut(t,b,c,d)
- if t> d then
- t = d
- end
- if t <d/2 then
- return UIUtil.EaseIn(t,b,(b+c)/2,d/2);
- else
- local t1 = t-d/2;
- local b1 = (b + c)/2;
- return UIUtil.EaseOut(t1,b1,c,d/2);
- end
- end
- function UIUtil.EaseIn(t,b,c,d)
- if t> d then
- t = d
- end
- local x = t/d;
local y = x ^ 2; -- 这里的幂控制倾斜率
- return b+(c-b)*y;
- end
t 是当前时间, b 是起始数值, c 是最终数值, d 是终止时间
缓动公式
来源: http://www.bubuko.com/infodetail-3148400.html