text animations
Text Rotate
Cycles through an array of strings with per-character staggered enter and exit animations. Supports auto-advance, manual control via ref, configurable stagger origin, and custom Motion variants.
Installation
Usage
Anatomy
Good to know
- It cycles through
textsautomatically.rotationIntervalis in milliseconds (default2000). - Set
auto={false}to control it yourself withref.current.next(),previous(),jumpTo(index)andreset(). loop={false}stops on the last text.- Screen readers read the current text once; the animated letters are hidden from them.
- When the user has turned on reduced motion, texts still change on the interval but swap instantly, with no stagger or movement.
Props
Ref API
Pass a ref to control rotation imperatively:
Examples
Hero Inline
Audience descriptor cycles inline in a heading. staggerFrom="first" with a tight staggerDuration creates a character waterfall.
Manual Step Control
auto={false} disables the timer. Prev/Next buttons call ref.current.previous() and ref.current.next() to step through how-it-works copy word by word.
Feature Ticker
Short feature strings rotate with a fade+y tween instead of the default spring. Dot indicators below give a passive sense of progress.