text animations
Text Scramble
Characters scramble through random glyphs before resolving to the final text, creating a cipher-decoding effect on mount.
Installation
Usage
Anatomy
Good to know
childrenmust be a plain string.- It plays as soon as it mounts. Set
trigger={false}and switch it totrueto replay or delay it. durationandspeedare in seconds.onScrambleCompletefires when the text settles.- Screen readers may read the scrambled characters. Add an
aria-labelwith the final text if that matters. - When the user has turned on reduced motion, the text shows straight away with no scramble;
onScrambleCompletestill fires.
Props
Examples
Hero Headline
Auto-triggers on mount and resolves the full headline left-to-right. Increase duration for longer text.
Click to Retrigger
Manually controls the trigger prop by briefly resetting it, letting users replay the scramble on demand.
Scrambled Stats
Multiple TextScramble instances with staggered duration values create a sequential reveal across a stats row.