HOME

TheInfoList



OR:

Velocity is a
cross-platform Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
JavaScript library A JavaScript library is a library of pre-written JavaScript code that allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies. They can be included in a website by embedding it directl ...
designed to simplify the
client-side scripting A dynamic web page is a web page constructed at runtime (during software execution), as opposed to a ''static web page'', delivered as it is stored. A server-side dynamic web page is a web page whose construction is controlled by an application ...
of website animation. Velocity is free, open-source software licensed under the
MIT License The MIT License is a permissive software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts very few restrictions on reuse and therefore has high license compatibility. Unl ...
. It is the most popular open source web animation engine. Velocity's syntax is designed to make it easier to create complex animations for
HTML Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
and SVG elements. In addition to its workflow benefits, Velocity provides animation performance that is competitive with CSS-based animation. Velocity achieves its performance by maintaining an internal cache of animation states and minimizing "layout thrashing," the undesirable behavior that
web browsers A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scree ...
undergo when visually updating at a fast rate. Altogether, its workflow and performance benefits allow Velocity to be used for sophisticated animation programming that can be integrated into both web and mobile applications. Its broad browser and device support make it ideal for large enterprise distributions that must support low-powered devices. Velocity is used to power the user interfaces of many notable websites, including
Uber Uber Technologies, Inc. is an American multinational transportation company that provides Ridesharing company, ride-hailing services, courier services, food delivery, and freight transport. It is headquartered in San Francisco, California, a ...
,
Samsung Samsung Group (; stylised as SΛMSUNG) is a South Korean Multinational corporation, multinational manufacturing Conglomerate (company), conglomerate headquartered in the Samsung Town office complex in Seoul. The group consists of numerous a ...
,
WhatsApp WhatsApp (officially WhatsApp Messenger) is an American social media, instant messaging (IM), and voice-over-IP (VoIP) service owned by technology conglomerate Meta. It allows users to send text, voice messages and video messages, make vo ...
,
Tumblr Tumblr (pronounced "tumbler") is a microblogging and Social networking service, social networking website founded by David Karp in 2007 and is owned by American company Automattic. The service allows users to post multimedia and other content ...
, HTC,
Mazda is a Japanese Multinational corporation, multinational automotive manufacturer headquartered in Fuchū, Hiroshima (town), Fuchū, Hiroshima Prefecture, Hiroshima, Japan. The company was founded on January 30, 1920, as Toyo Cork Kogyo Co., Ltd. ...
, and
Microsoft Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
. It is one of the most favorited projects on the code hosting service
GitHub GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
. In 2015, Velocity was nominated for ''Open Source Project of the Year'' by The Net Awards.


Features

Velocity's features include: * Browser window and element scrolling * Independence from the jQuery framework * Animation reversal (the ability to undo the previous animation) and animation looping * SVG element animation * RGB and hex color animation * CSS's ''transform'' property animation * Pre-created animation effects via Velocity's ''UI Pack'' * Physics-based motion via the ''spring'' easing type * Promises integration


Browser support

Velocity supports all major desktop browsers (
Firefox Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements curr ...
,
Google Chrome Google Chrome is a web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, iOS, iPadOS, an ...
, and
Safari A safari (; originally ) is an overland journey to observe wildlife, wild animals, especially in East Africa. The so-called big five game, "Big Five" game animals of Africa – lion, African leopard, leopard, rhinoceros, African elephant, elep ...
) plus the
iOS Ios, Io or Nio (, ; ; locally Nios, Νιός) is a Greek island in the Cyclades group in the Aegean Sea. Ios is a hilly island with cliffs down to the sea on most sides. It is situated halfway between Naxos and Santorini. It is about long an ...
and Android mobile operating systems. Its support extends as far back as
Internet Explorer Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated as IE or MSIE) is a deprecation, retired series of graphical user interface, graphical web browsers developed by Microsoft that were u ...
8 and Android 2.3.


Usage


Including the library

The Velocity library is a single JavaScript file containing all of its core functions. It can be included within a web page by linking to a local copy or to one of the many copies available from public servers, including MaxCDN's jsDelivr or
Cloudflare Cloudflare, Inc., is an American company that provides content delivery network services, cybersecurity, DDoS mitigation, wide area network services, reverse proxies, Domain Name Service, ICANN-accredited domain registration, and other se ...
'
cdnjs
It is also possible to include Velocity directly from content delivery networks. (The integrity attribute is used for Subresource Integrity.) It is recommended to always use
HTTPS Hypertext Transfer Protocol Secure (HTTPS) is an extension of the Hypertext Transfer Protocol (HTTP). It uses encryption for secure communication over a computer network, and is widely used on the Internet. In HTTPS, the communication protoc ...
for resources but this can be replaced with // to make use of protocol relative URLs.


Usage styles

Velocity has two usage styles: * The $.Velocity function, which is a factory method extended from the jQuery root object. This method animates raw DOM elements instead of jQuery-wrapped elements. This is the style employed when using Velocity without jQuery on the page. * The $element.velocity() function. This is the style used for animating jQuery element objects when jQuery ''is'' present on the page. Animation calls in Velocity consist of supplying the desired element(s) to animate, an ''animation property map'' to specify the CSS properties to be animated, and an optional ''options object'' to specify animation settings (e.g. ''duration'').


Arguments

Velocity accepts one or more arguments. The first argument, which is required, can either be the name of a predefined Velocity command (e.g. ''scroll'' or ''reverse'') or an object consisting of CSS properties to be animated: // Animate an element's width to 100px and its left property to 200px $element.velocity(); The second argument, which is optional, is an object. It is used to specify animation options such as ''duration'', ''easing'', and ''complete'' (an arbitrary function to execute once the animation has completed): // Animate an element's width to 100px over a 1000ms duration after pausing for a 100s delay. $element.velocity(, );


Chaining

Creating a series of consecutive animation calls in Velocity consists of placing ''velocity()'' calls back-to-back on the target jQuery element object: $element .velocity(, ) // Continue on to this animation once the previous one has completed .velocity(, ) // And once more... .velocity(, );


Scrolling and reversal

Scrolling in Velocity consists of passing in ''"scroll"'' as Velocity's first argument — in place of the typical CSS properties map: // Scroll with a duration of 750 ms $element.velocity("scroll", ); The browser will subsequently scroll down to the top edge of the element that Velocity was invoked on. Animation reversal in Velocity consists of passing in ''"reverse"'' as Velocity's first argument: // Animate an element's height $element.velocity(, ); // Reverse the previous animation; animate back to the element's original height using the previous duration $element.velocity("reverse"); Velocity's ''reverse'' command defaults to the animation options used in the prior call. Passing in a new options object extends the previous one: $element.velocity(, ); // Extend the previous reverse call's options object with a new duration value $element.velocity("reverse", );


History

Velocity was developed by Julian Shapiro to address a lack of performant and designer-oriented
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
animation libraries. Stripe, a popular
web developer A web developer is a programmer who develops World Wide Web applications using a client–server model. The applications typically use HTML, CSS, and JavaScript in the client, and any general-purpose programming language in the server. is used ...
-focused Internet technology company sponsored Shapiro on a grant to help provide the financial resources necessary to continue full-time development on Velocity. The high performance of Velocity's internal animation engine helped to repopularize JavaScript-based web animation, which had previously fallen out of favor for CSS-based animation due to its speed advantages over older JavaScript libraries that lacked a focus on animation. In September 2014, Shapiro released ''Velocity Motion Designer'', a tool for designing animations on live production websites that allowed for real-time exporting of the generated animation code for subsequent use within an IDE. In March 2015, Peachpit published Shapiro's ''Web Animation using JavaScript'' book, which teaches both the beginning and advanced principles of developing web animations using Velocity. As of mid-2015, Velocity continues to be developed and maintained exclusively by Shapiro. In addition to Velocity's use in professional enterprise environments, it is also widely used for
web development Web development is the work involved in developing a website for the Internet (World Wide Web) or an intranet (a private network). Web development can range from developing a simple single static page of plain text to complex web applications, ...
experimentation and beginner practicing. Proof-of-concept web development projects built on top of Velocity are commonly posted to CodePen
example
, a leading community code sharing service.


See also

*
D3.js D3.js (also known as D3, short for Data-Driven Documents) is a JavaScript library for producing dynamic, interactive data visualizations in web browsers. It makes use of Scalable Vector Graphics (SVG), HTML5, and Cascading Style Sheets (CSS) stan ...
* Raphaël * Three.js * jQuery *
JavaScript framework A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build and ...
*
JavaScript library A JavaScript library is a library of pre-written JavaScript code that allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies. They can be included in a website by embedding it directl ...


Further reading


Animating without jQuery

How to use Velocity to easily add animations

Fast UI animation using Velocity.js


External links

*
Velocity demo gallery


References

{{Reflist JavaScript libraries Free software programmed in JavaScript Ajax (programming) Software using the MIT license 2014 software