bendc /animateplus

A+ animation module for the modern web

★ 5,948⑂ 277👁 150⑃ 6● 45▤ 0
JavaScriptMITCreated 2015-05-12
More from this author
+1
Daily
5,948
stars
277
forks
150
watchers
6
prs
45
issues
0
releases

README

Animate Plus

Animate Plus is a JavaScript animation library focusing on performance and authoring flexibility. It
aims to deliver a steady 60 FPS and weighs less than 3 KB (minified and compressed), making it particularly well-suited for mobile.

 Getting started

npm install animateplus or download animateplus.js and start animating things:

javascript
import animate from "/animateplus.js";

animate({
  elements: "div",
  duration: 2000,
  delay: index = index  100,
  transform: ["scale(0)", "scale(1)"]
})
.then(options = animate({
  ...options,
  transform: ["translate(0%)", "translate(500%)"]
}));


Preview this example &8594;

 Options

 elements

| Default | Type
| :---    | :---
| null  | String \| Element \| NodeList \| Array

Determines the DOM elements to animate. You can either pass it a CSS selector or DOM elements.

javascript
animate({
  elements: document.body.children,
  transform: ["rotate(0turn)", "rotate(1turn)"]
});


 easing

| Default       | Type
| :---          | :---
| out-elastic | String

Determines the acceleration curve of your animation.

| constant | accelerate     | decelerate      | accelerate-decelerate
| :---     | :---           | :---            | :---
| linear   | in-cubic       | out-cubic       | in-out-cubic
|          | in-quartic     | out-quartic     | in-out-quartic
|          | in-quintic     | out-quintic     | in-out-quintic
|          | in-exponential | out-exponential | in-out-exponential
|          | in-circular    | out-circular    | in-out-circular
|          | in-elastic     | out-elastic     | in-out-elastic

The amplitude and period of elastic easings can be configured by providing space-separated values.
Amplitude defaults to 1, period to 0.4.

javascript
// Increase elasticity
animate({
  elements: "span",
  easing: "out-elastic 1.4 0.2",
  transform: ["translate(0px)", "translate(500px)"]
});


 duration

| Default | Type
| :---    | :---
| 1000  | Number \| Function

Determines the duration of your animation in milliseconds. By passing it a callback, you can define
a different duration for each element. The callback takes the index of each element as its argument
and returns a number.

javascript
// First element fades out in 1s, second element in 2s, etc.
animate({
  elements: "span",
  easing: "linear",
  duration: index = (index + 1)  1000,
  opacity: [1, 0]
});


 delay

| Default | Type
| :---    | :---
| 0     | Number \| Function

Determines the delay of your animation in milliseconds. By passing it a callback, you can define
a different delay for each element. The callback takes the index of each element as its argument
and returns a number.

javascript
// First element fades out after 1s, second element after 2s, etc.
animate({
  elements: "span",
  easing: "linear",
  delay: index = (index + 1)  1000,
  opacity: [1, 0]
});


 loop

| Default | Type
| :---    | :---
| false | Boolean

Determines if the animation should repeat.

 direction

| Default  | Type
| :---     | :---
| n

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON