React AnimeJS

Scope

Code

1// A single useAnime() with a CSS selector scopes the animation to every
2// matching element inside the component. `stagger` ripples the tween across
3// the matched targets. autoplay:false + controls.restart() = click-to-play.
4const { controls } = useAnime({
5 selector: '.scope-dot',
6 scale: [
7 { to: 1.5, duration: 200 },
8 { to: 1, duration: 300 },
9 ],
10 stagger: 50,
11 autoplay: false,
12})
13
14// Trigger re-runs the same scoped tween against all dots.
15<button onClick={() => controls.restart()}>Trigger</button>

Scoped animation contexts — one useAnime call targets many elements via a selector.

Live previewOpen Playground
ScopeScoped animation contexts
Props
NameTypeDefaultDescription
selectorstring-CSS selector scoping the animation to multiple elements
scaleobject[]-Keyframes with per-segment { to, duration }
staggernumber0Delay ripple between matched targets
autoplaybooleanfalseStart on mount (false = trigger via controls)
controls.restartfunction-Re-run the scoped animation

Related components