这是我的动画:
elem.animate({ left: stepLeft + "px" }, timing, "MyOwnEasingFunction", function () {
// somethings
});
我想用我自己的函数替换MyOwnEasingFunction
,它使用这个缓动:
$.easing.bw = function(x, t, b, c, d) {
ts=(t/=d)*t;
tc=ts*t;
return b+c*(25.8*tc*ts + -78.5*ts*ts + 89.6*tc + -47.4*ts + 11.50*t);
}
但我怎么称呼它?
答案 0 :(得分:1)
查看jQuery easing function — variables' comprehension,它将采用以下格式
$.extend(jQuery.easing,{MyOwnEasingFunction:function(x, t, b, c, d) {
ts=(t/=d)*t;
tc=ts*t;
return b+c*(25.8*tc*ts + -78.5*ts*ts + 89.6*tc + -47.4*ts + 11.50*t);
}});
elem.animate({ left: stepLeft + "px" }, timing, "MyOwnEasingFunction", function () {
// somethings
});
答案 1 :(得分:0)
elem.animate({ left: stepLeft + "px" }, timing, function(x, t, b, c, d) {
ts=(t/=d)*t;tc=ts*t;return b+c*(25.8*tc*ts + -78.5*ts*ts + 89.6*tc + -47.4*ts + 11.50*t);
}, function () {
// somethings
});