anime-js · mindrally — Claude Code skill: Anime.js animations
A skill that gives your agent rules for writing Anime.js animations: timelines, stagger, SVG morphing and performance. Useful when AI writes the motion code.
npx skills add Mindrally/skills --skill anime-js -a claude-codeWhat anime-js does
The skill hands your agent a working knowledge of Anime.js. It covers the basics of anime(), timelines with overlapping offsets, stagger with grid layout, SVG path morphing and line drawing through strokeDashoffset. There is a React section too: run the animation inside useEffect and call pause() on unmount so nothing keeps ticking.
Performance gets its own treatment. Animate translateX, scale and rotate; leave left, top and width alone, because those force a layout recalculation. For continuous updates such as cursor tracking the skill points to Animatable. It also shows the Web Animations API bridge via wapiAnimate and a prefers-reduced-motion check so motion can be switched off.
One thing to sort out first: the project needs the library itself, installed with npm install animejs. The source file cuts off inside the best-practices section, so treat the guidance as a starting set rather than the whole list.
What it helps with
- build a multi-step timeline with overlapping segments
- stagger a grid of cards into view
- draw an SVG line from start to finish
- run an animation in a React component and stop it on unmount
- turn motion off for users who prefer reduced motion
Example prompts for the agent
- animate the card grid with anime.js and stagger from the center
- rewrite this timeline so the blocks overlap by 500ms
- animate the SVG path with strokeDashoffset and respect prefers-reduced-motion
How to install anime-js
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill anime-js -a claude-code2Manually: put the files in place
~/.claude/skills/anime-js/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/anime-js/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill anime-js -a codex2Manually: put the files in place
.agents/skills/anime-js/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill anime-js -a cursor2Manually: put the files in place
.cursor/skills/anime-js/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills anime-js2Manually: put the files in place
.github/skills/anime-js/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill anime-js -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path anime-jsManually: put the files in place
.devin/skills/anime-js/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill anime-js -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about anime-js
How do I install anime-js in Claude?
Run npx skills add Mindrally/skills --skill anime-js -a claude-code. The skill file lands at ~/.claude/skills/anime-js/SKILL.md.
What does the anime-js skill do?
It gives the agent guidelines for Anime.js: basic animations, timelines, stagger, easing, SVG work and React integration. Performance is covered separately, with transforms preferred over layout properties.
Do I need the Anime.js library installed?
Yes. The skill documents working with it and includes npm install animejs. Without the package the examples will not run.
Source text
SKILL.md · Apache-2.0
---
name: anime-js
description: Expert guidelines for building performant animations with Anime.js animation library
metadata:
maintainer: Mindrally
source: https://github.com/Mindrally/skills
---
# Anime.js Animation Guidelines
You are an expert in Anime.js, JavaScript, and web animation performance. Follow these guidelines when creating animations.
## Core Principles
### Installation and Import
```bash
npm install animejs
```
```javascript
// Full import
import anime from "animejs";
// Modular import for smaller bundle size
import { animate, timeline, stagger } from "animejs";
```
### Basic Animation
```javascript
anime({
targets: ".element",
translateX: 250,
rotate: "1turn",
duration: 800,
easing: "easeInOutQuad"
});
```
## Performance Optimization
### Frame Rate Control
```javascript
// Adjust global frame rate for lower-end devices
anime.suspendWhenDocumentHidden = true;
// Control FPS for specific animations
anime({
targets: ".element",
translateX: 250,
update: function(anim) {
// Custom frame rate limiting if needed
}
});
```
### Use Transforms Over Layout Properties
```javascript
// Good - uses GPU-accelerated transforms
anime({
targets: ".element",
translateX: 100, // Good
translateY: 50, // Good
scale: 1.2, // Good
rotate: 45, // Good
opacity: 0.5 // Good
});
// Avoid - causes layout recalculation
anime({
targets: ".element",
left: 100, // Avoid
top: 50, // Avoid
width: 200, // Avoid
height: 150 // Avoid
});
```
### Use Animatable for High-Frequency Updates
```javascript
import { Animatable } from "animejs";
// Optimized for continuous updates (mouse tracking, etc.)
const animatable = new Animatable(".cursor", {
x: 0,
y: 0
});
document.addEventListener("mousemove", (e) => {
animatable.x = e.clientX;
animatable.y = e.clientY;
});
```
## Timeline Animations
### Basic Timeline
```javascript
const tl = anime.timeline({
easing: "easeOutExpo",
duration: 750
});
tl.add({
targets: ".header",
translateY: [-50, 0],
opacity: [0, 1]
})
.add({
targets: ".content",
translateY: [30, 0],
opacity: [0, 1]
}, "-=500") // Overlap by 500ms
.add({
targets: ".footer",
translateY: [30, 0],
opacity: [0, 1]
}, "-=500");
```
### Timeline Controls
```javascript
const tl = anime.timeline({
autoplay: false
});
// Control methods
tl.play();
tl.pause();
tl.restart();
tl.reverse();
tl.seek(1000); // Go to 1 second
```
## Stagger Animations
### Basic Stagger
```javascript
anime({
targets: ".grid-item",
translateY: [50, 0],
opacity: [0, 1],
delay: anime.stagger(100) // 100ms delay between each
});
```
### Advanced Stagger Options
```javascript
// Stagger from center
anime({
targets: ".grid-item",
scale: [0, 1],
delay: anime.stagger(100, { from: "center" })
});
// Grid stagger
anime({
targets: ".grid-item",
scale: [0, 1],
delay: anime.stagger(50, {
grid: [14, 5],
from: "center"
})
});
// Stagger with easing
anime({
targets: ".item",
translateX: 250,
delay: anime.stagger(100, { easing: "easeOutQuad" })
});
```
## Easing Functions
### Built-in Easings
```javascript
// Common easings
anime({
targets: ".element",
translateX: 250,
easing: "easeOutExpo" // Fast start, slow end
// easing: "easeInOutQuad" // Smooth both ends
// easing: "easeOutElastic(1, .5)" // Bouncy
// easing: "easeOutBounce" // Bounce effect
// easing: "spring(1, 80, 10, 0)" // Physics-based
});
```
### Custom Easing
```javascript
anime({
targets: ".element",
translateX: 250,
easing: "cubicBezier(0.25, 0.1, 0.25, 1)"
});
```
## SVG Animation
### Path Animation
```javascript
const path = anime.path(".motion-path");
anime({
targets: ".element",
translateX: path("x"),
translateY: path("y"),
rotate: path("angle"),
easing: "linear",
duration: 2000,
loop: true
});
```
### Line Drawing
```javascript
anime({
targets: "path",
strokeDashoffset: [anime.setDashoffset, 0],
easing: "easeInOutSine",
duration: 1500,
delay: anime.stagger(250)
});
```
### Morphing
```javascript
anime({
targets: "path",
d: [
{ value: "M10 10 L90 10 L90 90 L10 90 Z" },
{ value: "M10 50 Q50 10 90 50 Q50 90 10 50 Z" }
],
easing: "easeInOutQuad",
duration: 1000,
loop: true,
direction: "alternate"
});
```
## Function-Based Values
### Dynamic Values
```javascript
anime({
targets: ".element",
translateX: function(el, i) {
return i * 100; // Each element moves further
},
rotate: function(el, i, total) {
return (360 / total) * i; // Distribute rotation
},
delay: function(el, i) {
return i * 50;
}
});
```
## Callbacks and Events
### Animation Events
```javascript
anime({
targets: ".element",
translateX: 250,
begin: function(anim) {
console.log("Animation started");
},
update: function(anim) {
console.log(Math.round(anim.progress) + "%");
},
complete: function(anim) {
console.log("Animation completed");
}
});
```
### Looping
```javascript
anime({
targets: ".element",
translateX: 250,
direction: "alternate",
loop: true,
loopComplete: function(anim) {
console.log("Loop completed");
}
});
```
## React Integration
### Basic React Usage
```tsx
import { useEffect, useRef } from "react";
import anime from "animejs";
function AnimatedComponent() {
const elementRef = useRef(null);
useEffect(() => {
const animation = anime({
targets: elementRef.current,
translateX: 250,
duration: 800
});
return () => {
animation.pause(); // Cleanup
};
}, []);
return <div ref={elementRef}>Animated</div>;
}
```
### With useCallback for Controls
```tsx
function ControlledAnimation() {
const elementRef = useRef(null);
const animationRef = useRef(null);
const playAnimation = useCallback(() => {
animationRef.current = anime({
targets: elementRef.current,
translateX: [0, 250],
duration: 800
});
}, []);
useEffect(() => {
return () => {
animationRef.current?.pause();
};
}, []);
return (
<>
<div ref={elementRef}>Animated</div>
<button onClick={playAnimation}>Play</button>
</>
);
}
```
## Web Animations API Bridge
### Using WAAPI for Native Performance
```javascript
import { wapiAnimate } from "animejs";
// Uses browser's native Web Animations API
wapiAnimate(".element", {
translateX: 250,
duration: 800
});
```
## Accessibility
### Respect Reduced Motion
```javascript
const prefersReducedMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
anime({
targets: ".element",
translateX: 250,
duration: prefersReducedMotion ? 0 : 800,
easing: prefersReducedMotion ? "linear" : "easeOutExpo"
});
```
## Best Practices Summary
1. Use transforms (translate, scale, rotate) over layout properties
2. Import only needed modules for smaller bundle size
3. Use stagger for multiple element animations
4. Clean up animations on component unmount
5. Use Animatable for high-frequency updates
6. Leverage timeline for complex sequences
7. Use function-based values for dynamic animations
8. Respect reduced motion preferences
9. Consider WAAPI bridge for native performance
10. Test on lower-powered devices
© Mindrally · Apache-2.0 · Mindrally/skills
Similar skills
Everything for Frontend and UI →anime-js by other authors comes first.