Scramble-reveal animation that decodes pseudo-random characters progressively into the final text, with optional in-view trigger and preset character sets.
Installation
Usage
How It Works
- The animation runs in two phases: scramble (random characters expand outward) then reveal (characters lock in left-to-right).
- During scramble, each step adds one more random character to the visible range, avoiding consecutive duplicates.
- During reveal, characters resolve one-by-one with a blinking
_cursor marking the current position. speedcontrols the interval in milliseconds between each animation step.delaydefers the start by the given number of seconds.triggerOnViewuses an Intersection Observer to start the animation only when the element enters the viewport.oncecontrols whether the view trigger fires only on first entry or re-fires on every re-entry.presetselects a built-in scramble character pool; passcharactersto use a custom pool instead.
API Reference
TextReveal
| Prop | Type | Default |
|---|---|---|
children | string | - |
speed? | number | 20 |
delay? | number | 0 |
className? | string | - |
triggerOnView? | boolean | false |
once? | boolean | true |
characters? | string | - |
preset? | "default" | "binary" | "cyberpunk" | "minimal" | "default" |
CharacterPreset
| Prop | Type | Default |
|---|---|---|
default? | string | - |
binary? | string | - |
cyberpunk? | string | - |
minimal? | string | - |