Velocity.js

加速 JavaScript 动画。(Accelerated JavaScript animation.)

Github星跟蹤圖

Velocity是一个与 jQuery $.animate() 相同的API的动画引擎。它可以在不使用jQuery的情况下工作。它的速度非常快,它的特点是色彩动画、转换、循环、画架、SVG支持和滚动。它是最好的jQuery和CSS转换组合。

下载 Velocity,将其包含在页面上,并使用 $.Velocity() 替换 jQuery $.animate() 的所有实例。您将立即看到在所有浏览器和设备上的性能提升,尤其是在移动设备上。

兼容性:Velocity 在任何地方都能回到IE8和Android 2.3。在底层,它模仿 jQuery $.queue(),并与jQuery $.animate()、$.fade() 和 $.delay() 无缝地进行交互。因为Velocity的语法与 $.animate() 相同,所以您的代码不需要更改。

秘诀:JavaScript和jQuery被错误地合并了。速度使用的JavaScript动画速度很快;jQuery是缓慢的。尽管Velocity与jQuery一起工作,但它使用自己的动画堆栈,通过两个基本原则来实现其性能:1)同步DOM渐变堆栈以最小化布局抖动,2)缓存值以最小化DOM查询。

概覽

名稱與所有者julianshapiro/velocity
主編程語言JavaScript
編程語言JavaScript (語言數: 4)
平台Linux, Mac, Windows
許可證MIT License
發布數119
最新版本名稱v2.0.6 (發布於 2020-04-10 14:00:55)
第一版名稱v0.0.1 (發布於 )
創建於2014-04-09 20:02:38
推送於2020-10-24 07:45:51
最后一次提交2020-08-02 08:10:02
星數17.3k
關注者數403
派生數1.6k
提交數895
已啟用問題?
問題數815
打開的問題數41
拉請求數54
打開的拉請求數0
關閉的拉請求數62
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

# Velocity beta

npm npm (tag) cdnjs version npm downloads jsdelivr downloads

NPM: npm install velocity-animate@beta

Docs

https://github.com/julianshapiro/velocity/wiki

IMPORTANT: The velocityjs.org documentation refers to V1, not V2 beta - use the wiki for latest documentation!

News

WhatsApp, Tumblr, Windows, Samsung, Uber, and thousands of other companies rely on Velocity. Visit Libscore.com to see which sites use Velocity on their homepage.

React Plugin

Announcement: https://fabric.io/blog/introducing-the-velocityreact-library
Repo: https://github.com/twitter-fabric/velocity-react
NPM: https://www.npmjs.com/package/velocity-react

Quickstart

Velocity (CDN, choose one of them):

<script src="//cdn.jsdelivr.net/npm/velocity-animate@2.0/velocity.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/velocity/2.0.3/velocity.min.js"></script>

Velocity UI pack (CDN, choose one of them):

<script src="//cdn.jsdelivr.net/npm/velocity-animate@2.0/velocity.ui.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/velocity/2.0.3/velocity.ui.min.js"></script>

Please note that JSDelivr can automatically supply the latest release, while CloudFlare needs to ask for a specific version.

Package managers:

npm: npm install velocity-animate@beta

Automagic chaining:

If using the .velocity(...) chained function in libraries such as jQuery or Zepto you need to ensure that Velocity is loaded after them. If you wish to add it to anything loaded afterwards then look at the Velocity.patch() method.

Questions or Problems?

Ask on StackOverflow (make sure you add the [velocity.js] and the [javascript] or [typescript] tags).

Updates

  • 2.0: Typescript update and complete refactoring.
  • 1.5: Bugfixes, IE9 compatibility fixes.
  • 1.4: Pause / Resume (per element or global).
    Forcefed string animation (just have matching number spaces) including unit conversions and colour names (ie background:["rgba(red,0.1)", "blue"]).
    High resolution timers (animations should be slightly smoother).
    Various fixes including ticker (loading Velocity in a background window) and color handling.
  • 1.3: Code cleanup - no breaking changes known.
  • 1.2: Custom tweens. Custom easings. "Finish" command.
  • 1.0: File name changed to velocity.js. Read VelocityJS.org/#dependencies.
  • 0.1: stop now stops animations immediately (instead of only clearing the remainder of the animation queue). No other backwards-incompatible changes were made.

Learn

Comparisons

  • CSS transitions are meant for simple interface flourishes.
  • jQuery's $.animate() is slow and poorly-equipped for motion design.
  • Velocity is a fast, feature-rich standalone alternative to jQuery's $.animate().

License

MIT License. © Julian Shapiro (http://twitter.com/julian).

Sponsors

Kiss My Button sponsors Velocity's development.

BrowserStack provides browser testing services for Velocity.

去到頂部