animejs
Comprehensive skill for Anime.js v4 - a fast and flexible JavaScript animation library. This skill should be used when implementing web animations, creating timelines, working with SVG animations, scroll-based animations, draggable elements, staggered effects, or any JavaScript-based animation on the web. Triggers on: "anime.js", "animejs", "animate elements", "CSS animation with JS", "timeline animation", "stagger animation", "SVG morphing", "motion path", "scroll animation", "draggable", "spring animation", "keyframe animation".
What this skill does
# Anime.js v4 Skill
Anime.js is a lightweight JavaScript animation library with a simple yet powerful API. It works with CSS properties, SVG, DOM attributes, and JavaScript Objects.
## Installation
### NPM
```bash
npm install animejs
```
### ES Modules Import
```javascript
import { animate } from 'animejs';
```
### CDN (ES Modules)
```javascript
import { animate } from 'https://esm.sh/animejs';
```
### CDN (UMD)
```html
<script src="https://cdn.jsdelivr.net/npm/animejs/dist/bundles/anime.umd.min.js"></script>
<script>
const { animate } = anime;
</script>
```
## Core Concepts
Anime.js v4 is modular and tree-shakeable. Import only what you need:
```javascript
// Full import
import { animate, createTimeline, stagger, createDraggable } from 'animejs';
// Standalone modules for smaller bundles
import { animate } from 'animejs/animation';
import { createTimeline } from 'animejs/timeline';
import { createTimer } from 'animejs/timer';
```
## Documentation Sitemap
The complete anime.js v4 documentation structure:
### Getting Started
- Installation (NPM, CDN, Direct download)
- Module imports (ES Modules, CommonJS, UMD)
- Using with vanilla JS
- Using with React
### Timer (`createTimer`)
- **Playback Settings**: delay, duration, loop, loopDelay, alternate, reversed, autoplay, frameRate, playbackRate
- **Callbacks**: onBegin, onComplete, onUpdate, onLoop, onPause, then()
- **Methods**: play(), reverse(), pause(), restart(), alternate(), resume(), complete(), reset(), cancel(), revert(), seek(), stretch()
- **Properties**: currentTime, progress, paused, completed, etc.
### Animation (`animate`)
- **Targets**: CSS Selector, DOM Elements, JavaScript Objects, Array of targets
- **Animatable Properties**: CSS Properties, CSS transforms, CSS Variables, JS Object properties, HTML Attributes, SVG Attributes
- **Tween Value Types**: Numerical, Unit conversion, Relative (+=, -=, *=), Color, Color function, CSS variable, Function based
- **Tween Parameters**: to, from, delay, duration, ease, composition, modifier
- **Keyframes**: Tween values, Tween parameters, Duration based, Percentage based
- **Playback Settings**: delay, duration, loop, loopDelay, alternate, reversed, autoplay, frameRate, playbackRate, playbackEase, persist
- **Callbacks**: onBegin, onComplete, onBeforeUpdate, onUpdate, onRender, onLoop, onPause, then()
- **Methods**: play(), reverse(), pause(), restart(), alternate(), resume(), complete(), cancel(), revert(), reset(), seek(), stretch(), refresh()
### Timeline (`createTimeline`)
- Add timers, Add animations, Sync WAAPI animations, Sync timelines, Call functions
- **Time Position**: Absolute (ms), Relative (<, >, +=, -=), Labels
- **Playback Settings**: defaults, delay, loop, loopDelay, alternate, reversed, autoplay, frameRate, playbackRate, playbackEase
- **Callbacks**: onBegin, onComplete, onBeforeUpdate, onUpdate, onRender, onLoop, onPause, then()
- **Methods**: add(), set(), sync(), label(), remove(), call(), init(), play(), reset(), reverse(), pause(), restart(), alternate(), resume(), complete(), cancel(), revert(), seek(), stretch(), refresh()
### Animatable (`createAnimatable`)
- **Settings**: unit, duration, ease, modifier
- **Methods**: Getters, Setters, revert()
### Draggable (`createDraggable`)
- **Axes Parameters**: x, y, snap, modifier, mapTo
- **Settings**: trigger, container, containerPadding, containerFriction, releaseContainerFriction, releaseMass, releaseStiffness, releaseDamping, velocityMultiplier, minVelocity, maxVelocity, releaseEase, dragSpeed, dragThreshold, scrollThreshold, scrollSpeed, cursor
- **Callbacks**: onGrab, onDrag, onUpdate, onRelease, onSnap, onSettle, onResize, onAfterResize
- **Methods**: disable(), enable(), setX(), setY(), animateInView(), scrollInView(), stop(), reset(), revert(), refresh()
### Layout (`createLayout`) - NEW
- **Usage**: Specifying a root, CSS display animation, Staggered layout, DOM order animation, Enter/Exit layout animation, Swap parent animation, Modal dialog animation
- **Settings**: children, delay, duration, ease, properties
- **States**: enterFrom, leaveTo, swapAt
- **Methods**: record(), animate(), update(), revert()
- Layout id attribute, Callbacks, Properties, Common gotchas
### Scope (`createScope`)
- Add constructor function, Register method function
- **Parameters**: root, defaults, mediaQueries
- **Methods**: add(), addOnce(), keepTime(), revert(), refresh()
### Events / Scroll (`onScroll`)
- **Settings**: container, target, debug, axis, repeat
- **Thresholds**: Numeric values, Positions shorthands, Relative position values, Min max
- **Synchronisation Modes**: Method names, Playback progress, Smooth scroll, Eased scroll
- **Callbacks**: onEnter, onEnterForward, onEnterBackward, onLeave, onLeaveForward, onLeaveBackward, onUpdate, onSyncComplete, onResize
- **Methods**: link(), refresh(), revert()
### SVG Utilities
- `morphTo()` - SVG shape morphing
- `createDrawable()` - SVG line drawing animation
- `createMotionPath()` - Motion path animation
### Text Utilities (`splitText`)
- **Settings**: lines, words, chars, debug, includeSpaces, accessible
- **Split Parameters**: class, wrap, clone
- HTML template support
- **Methods**: addEffect(), revert(), refresh()
### Utilities
- `stagger()` - Time/values/timeline staggering with grid support
- `$()` - Query selector utility
- `get()` / `set()` - Get/set CSS property values
- `cleanInlineStyles()` - Remove inline styles
- `remove()` - Remove animations from targets
- `sync()` - Synchronize animations
- `keepTime()` - Time keeper utility
- `random()` / `createSeededRandom()` / `randomPick()` / `shuffle()` - Random utilities
- `round()` / `clamp()` / `snap()` / `wrap()` - Math utilities
- `mapRange()` / `lerp()` / `damp()` - Interpolation utilities
- `roundPad()` / `padStart()` / `padEnd()` - String padding
- `degToRad()` / `radToDeg()` - Angle conversion
- Chain-able utilities
### Easings
- **Built-in**: linear, easeIn, easeOut, easeInOut (with Quad, Cubic, Quart, Quint, Sine, Expo, Circ, Back, Elastic, Bounce variants)
- **Custom**: Cubic Bezier, Linear (multi-point), Steps, Irregular
- **Spring**: `createSpring({ stiffness, damping, mass, velocity })`
### WAAPI (Web Animation API)
- When to use WAAPI vs JS animation
- Hardware-accelerated animations
- Improvements to native WAAPI
- API differences (iterations, direction, easing, finished)
- `waapi.convertEase()`
### Engine Configuration
- **Parameters**: timeUnit (ms/s), speed, fps, precision, pauseOnDocumentHidden
- **Methods**: update(), pause(), resume()
- Engine defaults
## Quick Reference
### Basic Animation
```javascript
import { animate } from 'animejs';
animate('.element', {
translateX: 250,
rotate: '1turn',
duration: 800,
ease: 'outExpo'
});
```
### Timeline
```javascript
import { createTimeline } from 'animejs';
const tl = createTimeline({ defaults: { duration: 500 } });
tl.add('.box1', { x: 100 })
.add('.box2', { x: 100 }, '<') // Start with previous
.add('.box3', { x: 100 }, '-=200'); // 200ms before end
```
### Stagger
```javascript
import { animate, stagger } from 'animejs';
animate('.item', {
translateY: [-20, 0],
opacity: [0, 1],
delay: stagger(100, { from: 'center' }),
duration: 600
});
```
### Scroll Animation
```javascript
import { animate, onScroll } from 'animejs';
animate('.element', {
translateX: [0, 500],
autoplay: onScroll({
target: '.element',
sync: true
})
});
```
### SVG Line Drawing
```javascript
import { animate, createDrawable } from 'animejs';
animate(createDrawable('path'), {
draw: ['0 0', '0 1'],
duration: 2000,
ease: 'inOutQuad'
});
```
### Draggable
```javascript
import { createDraggable, createSpring } from 'animejs';
createDraggable('.draggable', {
container: '.container',
releaseEase: createSpring({ stiffness: 200, damping: 20 })
});
```
### Function-Based Values
```javascript
animate('.element', {
translateX: (el, i, total) => i * 50,
rotate: (el, i) Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.