Anime.js
v4.5.0Lightweight animation engine for CSS properties, SVG, DOM attributes and objects.
Quick start
Add this tag to your page. Place it just before the closing </body> tag, or in the <head> with the defer attribute.
HTML
<script src="https://jscdns.net/libs/animejs/4.5.0/anime.umd.min.js"
integrity="sha384-InMmvD3VoYcY7hGjSC80aLb2bNNE4CzpX+Eq6FVDlmB0IKgDvmfPw4UY8L/M++iG" crossorigin="anonymous"></script>Files
| File | Size | Copy |
|---|---|---|
| anime.umd.min.jsScript | 115.3 KB | |
| anime.esm.min.jsES module | 115.9 KB |
Usage
Complete example
A minimal page that loads Anime.js and uses it. Copy it into a file and open it in your browser.
example.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<script src="https://jscdns.net/libs/animejs/4.5.0/anime.umd.min.js"
integrity="sha384-InMmvD3VoYcY7hGjSC80aLb2bNNE4CzpX+Eq6FVDlmB0IKgDvmfPw4UY8L/M++iG" crossorigin="anonymous"></script>
<script>
const { animate, stagger } = anime;
animate('.box', {
x: 240,
rotate: '1turn',
duration: 1200,
delay: stagger(150),
ease: 'inOutQuad'
});
</script>
</body>
</html>Using the ES module build
If your page already uses <script type="module">, you can import the module build directly instead of relying on a global variable.
module.html
<script type="module">
import { animate, stagger } from 'https://jscdns.net/libs/animejs/4.5.0/anime.esm.min.js';
animate('.box', { x: 240, delay: stagger(150) });
</script>Good to know. Version 4 changed the API. Functions are now exposed on the anime object, for example anime.animate() and anime.stagger(), instead of calling anime() directly.