Anime.js v4 for Vibe Coders: Staggers, Scroll Animations, and Text Reveals Your AI Gets Right
Anime.js is one of the best JavaScript animation libraries around, and AI tools keep writing the wrong version of it. Here's what anime.js v4 does best and how to get your AI to use it correctly.
Anime.js is a lightweight JavaScript animation library that's been a favorite of front-end developers for years. It's great at the kind of motion that plain CSS struggles with: choreographed sequences, staggered grids, scroll-driven effects, and animated SVGs.
Version 4 brought a big rewrite with a cleaner, modular API. And that's where a lot of vibe coders hit a wall.
The v3 problem
Ask an AI tool to animate something with anime.js and there's a good chance it writes old v3 syntax, the classic anime({ targets: ... }) style. That's what most of the code on the internet looked like for years, so it's what the models learned.
The catch: anime.js v4 changed the API. Functions are imported individually, and the old syntax doesn't work the same way. Here's the same stagger in both versions:
// v3 (what AI tools usually write)
anime({ targets: '.card', translateY: [20, 0], delay: anime.stagger(100) });
// v4
import { animate, stagger } from 'animejs';
animate('.card', { translateY: [20, 0], delay: stagger(100) });So you get code that looks right and breaks when you run it. Then you spend an hour debugging something that was never going to work.
This is one of the most common frustrations with AI-generated animation code, and it's completely avoidable once your AI knows the v4 API.
What anime.js does best
Here's where it shines, and why it's worth learning even if you lean on CSS for simple stuff.
- Stagger animations. Animate a grid or list of items one after another with a single setting. Cards that cascade in, tiles that ripple from the center, list items that slide in one by one. This is where anime.js feels like magic.
- Timelines. Chain animations together in a precise sequence with control over timing and overlap. Great for hero sections and product reveals.
- Scroll triggered animation. Start animations when elements enter the screen, or sync them directly to scroll position for scrubbing effects.
- SVG animation. Draw lines as if a pen is tracing them, morph one shape into another, or move objects along a path.
- Draggable elements. Make things draggable with spring physics so they snap back or settle naturally.
- Text effects. Letter-by-letter reveals and scramble effects for headlines.
- Layout transitions. Smoothly animate lists and grids when items get added, removed, or reordered.
It works in plain HTML and in React or Next.js, and it can even drive Three.js 3D scenes for scroll-based product views. How to play video on scroll →
When to use it instead of CSS
CSS is great for simple hovers, fades, and transitions. Reach for anime.js when you need:
- Choreography (many elements animating in a planned order)
- Scroll-linked motion
- SVG effects
- Physics
- Play, pause, and scrub controls
If you're fighting CSS keyframes to get something to sequence right, that's your signal.
Get your AI writing correct v4 code
The fastest fix for the v3 problem is giving your AI tool a skill that teaches it the v4 API. The Anime.js skill does exactly that. It covers staggers, timelines, scroll-synced and scroll-triggered animation, SVG drawing and morphing, motion paths, draggable springs, text reveals, layout transitions, and Three.js, with patterns for plain HTML and React. It also helps update old v3 code to the new syntax.
Drop it into your project and your AI stops writing animation code that breaks. If you've been looking for anime.js examples that work on the first try, this is the shortcut.
Get the Anime.js skill →