Scramble/decode text animation for React, Vue, Svelte, and vanilla JS.
zero dependencies · ~2.8 kB core · grapheme-safe · deterministic seeds · respects reduced motion
Hover states, live values, redaction, sequenced reveals — every card is the real library running with different options.
All ten built-in glyph pools, same sample, so you can compare their texture. Click any card to replay it — or pass your own string of characters as charset.
Every control maps 1:1 to an option. The snippet underneath is copy-paste ready.
<Scramble
order="start"
charset="alnum"
duration={800}
stagger={20}
>
{text}
</Scramble>pnpm add scrmblThe adapters are thin wrappers over one framework-agnostic controller — every option works identically everywhere.
import { Scramble, useScramble } from "scrmbl/react";
// Component: animates on mount and on change
<Scramble charset="upper" order="random">{title}</Scramble>
// Hook: full control
const { ref, replay } = useScramble({ charset: "hex" });
<h1 ref={ref} onMouseEnter={replay}>C0FFEE</h1>scrmbl/reactThese are props in React, Vue, and Svelte, and an options object in vanilla.
| option | default | description |
|---|---|---|
| duration | 800 | Total animation time (ms). Always honored — stagger compresses for long text. |
| stagger | 20 | Delay (ms) between successive characters starting to resolve. |
| order | "start" | Resolve pattern: start · end · center · edges · random. |
| charset | "alnum" | Glyph pool: a preset name or any custom string of characters. |
| glyphRate | 30 | Glyph swaps per second while a character is scrambling. |
| ignore | "" | Characters never scrambled (whitespace never is, regardless). |
| scrambleAll | true | false = only animate characters that changed between updates. |
| sweep | false | Wave mode: characters hold their old glyph until their turn. |
| seed | — | Deterministic runs: same seed + text + options → identical frames. |
| respectReducedMotion | true | Snap instantly when the user prefers reduced motion. |
| onStart / onComplete | — | Animation lifecycle callbacks. |