[英]How can I call my own custom easing shape?
This is my animation: 这是我的动画:
elem.animate({ left: stepLeft + "px" }, timing, "MyOwnEasingFunction", function () {
// somethings
});
and I want to replace MyOwnEasingFunction
with my own function, which use this easing: 并且我想用自己的函数替换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);
}
but how can I call it? 但是我怎么称呼它呢?
Looking at jQuery easing function — variables' comprehension it would be in the following format 查看jQuery缓动函数-变量的理解应为以下格式
$.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
});
Fiddle here: http://fiddle.jshell.net/mme7dhx8/ 在这里提琴: http : //fiddle.jshell.net/mme7dhx8/
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
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.