Anime.js

106kb / ~36kb gz

A flexible JavaScript animation library that animates CSS, SVG, and JavaScript objects with one API.


01

See It in Action

Smart stagger patterns, spring physics, and JS object animation — things CSS can't touch.

Toast notifications slide in with staggered spring easing — a real UI pattern powered by anime.js stagger().

Preview

02

What is Anime.js?

Anime.js is a JavaScript animation library that lets you animate almost anything on the web — CSS properties, SVG elements, DOM attributes, and plain JavaScript objects — all with a single, consistent API.

Version 4 introduced spring physics for natural-feeling motion, smart stagger patterns that cascade animations across groups of elements, and a timeline system for choreographing multi-step sequences. It works with any framework or with vanilla JS.

Stagger Patterns
Cascade animations across groups of elements with built-in patterns — from center, from edges, grid-based, or with custom timing. CSS animation-delay can't do this dynamically.
Timeline Sequencing
Chain multiple animations with precise timing offsets using createTimeline(). Overlap, stagger, and synchronize steps without manual delay math.
🌊
Spring Physics
v4 adds spring-based easing that produces natural overshoot and settle. Unlike CSS cubic-bezier, springs react to velocity and can bounce multiple times.

03

When to Use Anime.js

Use when
Landing page entrance animations and micro-interactions
SVG animations including morphing, line drawing, and motion paths
Staggered list and grid animations for visual appeal
Lightweight projects where bundle size matters
Quick prototyping without complex setup
Avoid when
Extremely complex timeline choreography — GSAP's timeline is more battle-tested
Projects already using GSAP — avoid mixing animation libraries
When you need GSAP-specific plugins like MorphSVG or SplitText

04

How Anime.js Compares

Anime.js vs GSAP

Both are full-featured animation libraries. Anime.js v4 is an all-in-one bundle (106kb min) while GSAP uses a smaller core (72kb min) plus opt-in plugins. Anime.js has a simpler API with no licensing complexity — GSAP requires a paid license for some business uses.

Anime.js wins at
Simpler API, no license restrictions, all-in-one bundle
GSAP wins at
Smaller core, richer plugin ecosystem, more battle-tested at scale
Anime.js vs CSS Animations

CSS is simpler for basic transitions. Anime.js wins when you need JS-driven logic, stagger patterns, spring physics, or animating values CSS cannot access like JS objects.

Anime.js wins at
JS control, stagger patterns, spring physics, object animation
CSS Animations wins at
Zero JS, GPU-accelerated by default, simpler syntax
Anime.js vs Motion

Motion (formerly Framer Motion) is built for React with a declarative API and gesture support. Anime.js is framework-agnostic and works anywhere with vanilla JS.

Anime.js wins at
Framework-agnostic, vanilla JS, imperative control
Motion wins at
React integration, declarative API, gesture and layout animations

05

Get Started with Anime.js

Terminal
npm install animejs
Terminal
yarn add animejs
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/bundles/anime.umd.min.js"></script>
Quick Start
import { animate, stagger } from 'animejs';

// Animate elements
animate('.box', {
  translateX: 250,
  rotate: '1turn',
  duration: 800,
  delay: stagger(100),
  ease: 'outElastic(1, 0.5)'
});

06

Related Libraries