what are the different parameters in jQuery's

2019-03-05 11:47发布

问题:

I see jQuery's easing functions at https://github.com/danro/jquery-easing/blob/master/jquery.easing.js.

I see each function takes 5 paramaters but I can't figure out what all of them are and how they tie into a call to animate.

  • x - ????
  • t - current time - new Date()???
  • b - the beginning value
  • c - change in value ???
  • d - duration

For example, I would call a function like:

$("div").width(50).animate({
    width: 150px
}, 2000);

Would this call match up like so:

  • x - ????
  • t - the current time at each call to update
  • b - 50px
  • c - 100px
  • d - 2000

回答1:

x is an extra parameter not needed for the equations, but necessary for compatibility with jQuery

Reference : link

So x is equal to null and t is expressed in milliseconds since the start of the animation

I think you have right for the others.

You can see this post for more comprehension