ArticleslgStudy

computer science

Velocity (JavaScript library)

Velocity (JavaScript library) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Velocity (JavaScript library) rather than just read about it. In short: Velocity is a cross-platform JavaScript library designed to simplify the client-side scripting of website animation. Velocity is free, open-source software licensed under the MIT License.

Key takeaways

  • Velocity (JavaScript library) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Velocity (JavaScript library) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Velocity (JavaScript library) from memory before moving on to harder problems.

Reference excerpt

Velocity is a cross-platform JavaScript library designed to simplify the client-side scripting of website animation. Velocity is free, open-source software licensed under the MIT License. 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 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 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, Samsung, WhatsApp, Tumblr, HTC, Mazda, and Microsoft Windows. It is one of the most favorited projects on the code hosting service GitHub. 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, Google Chrome, and Safari) plus the iOS and Android mobile operating systems. Its support extends as far back as Internet Explorer 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's 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 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:

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):

Chaining Creating a series of consecutive animation calls in Velocity consists of placing velocity() calls back-to-back on the target jQuery element object:

Scrolling and reversal Scrolling in Velocity consists of passing in "scroll" as Velocity's first argument — in place of the typical CSS properties map:

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:

Velocity's reverse command defaults to the animation options used in the prior call. Passing in a new options object extends the previous one:

History Velocity was developed by Julian Shapiro to address a lack of performant and designer-oriented JavaScript animation libraries. Stripe, a popular web developer-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 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 Raphaël Three.js jQuery JavaScript framework JavaScript library

Further reading Animating without jQuery How to use Velocity to easily add animations Fast UI animation using Velocity.js

External links Official website Velocity demo gallery

References

Worked examples

Example 1 — a first encounter with Velocity (JavaScript library)

Start with the simplest possible case. Write down what Velocity (JavaScript library) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Velocity (JavaScript library) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Velocity (JavaScript library) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Velocity (JavaScript library)

In research
Velocity (JavaScript library) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Velocity (JavaScript library) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Velocity (JavaScript library) is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2014 software, Ajax (programming), Free software programmed in JavaScript, so understanding it makes those chapters shorter.
In everyday life
Look for Velocity (JavaScript library) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Velocity (JavaScript library)” →

How to study Velocity (JavaScript library) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Velocity (JavaScript library) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Velocity (JavaScript library) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Velocity (JavaScript library) in simple terms?

Velocity is a cross-platform JavaScript library designed to simplify the client-side scripting of website animation. Velocity is free, open-source software licensed under the MIT License.

Why does Velocity (JavaScript library) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Velocity (JavaScript library)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Velocity (JavaScript library).

Tags

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

Keep exploring