jQuery easing function — variables' comprehension

后端 未结 5 882
无人共我
无人共我 2020-11-30 01:00

How does the easing function for jQuery work? Take for example:

easeInQuad = function (x, t, b, c, d) {
    return c*(t/=d)*t + b;
};

How d

5条回答
  •  旧时难觅i
    2020-11-30 01:17

    t: current time, b: start value, c: change from the start value to the end value, d: duration.

    Here is how it works: http://james.padolsey.com/demos/jquery/easing/ (curve representing when a CSS property is changed).

    Here is how I would implement some dumb easing: http://www.timotheegroleau.com/Flash/experiments/easing_function_generator.htm (math is not my strong suit)

    You would extend like any of these: http://code.google.com/p/vanitytools/source/browse/trunk/website/js/custom_easing.js?spec=svn29&r=29 - good enough!

提交回复
热议问题