【问题标题】:what are the different parameters in jQuery's easing functionsjQuery的缓动函数中有哪些不同的参数
【发布时间】:2015-07-07 14:11:24
【问题描述】:

我在https://github.com/danro/jquery-easing/blob/master/jquery.easing.js 看到了 jQuery 的缓动函数。

我看到每个函数需要 5 个参数,但我无法弄清楚它们是什么以及它们如何与对 animate 的调用联系起来。

  • x - ????
  • t - 当前时间 - new Date()???
  • b - 起始值
  • c - 价值变化???
  • d - 持续时间

例如,我会调用如下函数:

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

这个调用会像这样匹配吗:

  • x - ????
  • t - 每次调用更新的当前时间
  • b - 50px
  • c - 100px
  • d - 2000

【问题讨论】:

  • 你为什么不阅读documentation而不是源代码?
  • @Andreas:我做了,但它没有回答我关于每个参数是什么的问题。

标签: javascript jquery animation


【解决方案1】:

x 是方程不需要的额外参数,但与 jQuery 兼容是必需的

参考:link

所以x 等于null 并且t 以动画开始后的毫秒数表示

我认为你对其他人有权利。

更多理解可以看this post

【讨论】:

  • 天哪。谢谢!您发布的链接正是我需要的。我很感激!
猜你喜欢
  • 2016-06-01
  • 2010-12-30
  • 2019-04-01
  • 2014-08-31
  • 1970-01-01
  • 1970-01-01
  • 2018-01-30
  • 2020-11-24
  • 1970-01-01
相关资源
最近更新 更多