React AnimeJS
Components/Basic Animation1 / 25

Basic Animation

coreBeginnerRead the docs

Code

1const { controls } = useAnime({
2 selector: '.box',
3 // Per-segment durations live inside keyframe objects, not at the top level.
4 translateX: [{ to: 120, duration: 600 }, { to: 0, duration: 400 }],
5 scale: [{ to: 1.2, duration: 300 }, { to: 1, duration: 300 }],
6 stagger: 80,
7 ease: 'inOutQuad',
8 autoplay: false, // trigger manually via controls.restart()
9})

Animate targets with CSS selectors, stagger, easing, and callbacks.

Live preview
Basic AnimationCSS selectors, stagger, easing
A
B
C
D
E
Props
NameTypeDefaultDescription
selectorstring-CSS selector to target
translateXobject[]-Keyframes with per-segment { to, duration }
staggernumber0Stagger delay between targets
easestring'inOutQuad'Easing function
autoplaybooleanfalseStart on mount (false = trigger via controls)
controls.restartfunction-Replay the animation

Related components