jquery - 如何将 jQuery 的动画过渡从线性更改为二次

标签 jquery animation effects slide

我想我注意到所有 jQuery 转换(例如幻灯片效果)都以线性方式工作。这意味着动画的速度永远不会改变。

我想知道是否可以将其更改为更加二次的行为。这意味着,我希望动画慢慢开始,然后变得更快。

jQuery 有没有办法实现这一点?

最佳答案

我不认为这是真的,大多数 jQuery 函数都有一个缓动参数(fadeIn/out、slideDown/up)
如果您使用slideDown (我举了一个例子)您可以指定一个 easing 选项,默认为 swing。如果您想要线性,则必须指定它

.slideDown( [duration] [, easing] [, callback] )

取自文档

Easing
As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing, and one that progresses at a constant pace, called linear. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.

关于jquery - 如何将 jQuery 的动画过渡从线性更改为二次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9214340/

相关文章:

jQuery 切换 div 与 <select> 字段

javascript - 将 div 从 div 中间到屏幕右下角动画到固定位置

wpf - 使用数据模板将 View 与 View 模型相关联时,如何动画化从一个 View 到另一个 View 的过渡

android - opencv android,捕获图像

stata - 你如何在 Stata 中使用 margins 命令存储边际效应?

html - 在 CSS 中应用文本描边和文本阴影?

javascript - jQuery 在另一个元素上触发 ("mouseenter"时从元素获取文本

javascript - 多个隐藏的全屏 div?

javascript - 从自定义打印按钮触发数据表打印

javascript - 如何巧妙地连续使用多个独特的动画