Animate.js Docs

There are probably 1,000 Javascript libraries called "animate.js" but this isn't a Javascript library. What if I told you you don't need a big ass library to do complex animations in the browser. This tiny 1.3 KB function is all you need.

View the interactive demo here, and the GitHub repo here.

Usage

Grab a copy of the code from here, or the minified code from here.

Demo

Basic usage looks like this:

import {animate} from './animate.js';

// Fade an element out
await animate({
	element: document.getElementById('header'),
	style_property: 'opacity',
	start_value: 1, 
	end_value: 0
});

Options

The function takes an options object, which can have the following properties:

Easings

Easings are based on the same Robert Penner algorithms used by jQuery. The options are:

linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint, easeInExpo, easeOutExpo, easeInOutExpo, easeInSine, easeOutSine, easeInOutSine, easeInCirc, easeOutCirc, easeInOutCirc, easeInElastic, easeOutElastic, easeInOutElastic, easeInBack, easeOutBack, easeInOutBack, easeInBounce, easeOutBounce, easeInOutBounce

Animate.js Demo

Animate Left to Right
Fade Out
Rotate
Multiple properties at once