Scramble
Each word arrives as random glyphs at the moment it is spoken and decodes left to right into the real letters. A free, MIT-licensed Remotion caption style.
$ pnpm dlx shadcn@latest add @remocn/caption-scrambleUsage
CaptionScramble keeps each word hidden until the voice reaches it. The word
then appears as random glyphs that resolve into the real letters from left to
right, taking as long as the word is spoken for, capped at 300ms, so short words
snap and long ones decode visibly. The glyphs re-roll every two frames and are
seeded from the frame, so every render is identical. The real word reserves its
space from the start, so the line never shifts while it builds. The component
renders only the text block, so place it inside your own AbsoluteFill — see
Positioning.
import { AbsoluteFill } from "remotion";
import { CaptionScramble } from "@/components/remocn/caption-scramble";
import captions from "./captions.json";
export const MyScene = () => (
<AbsoluteFill
style={{
justifyContent: "flex-end",
alignItems: "center",
paddingBottom: 108,
paddingInline: 192,
}}
>
<CaptionScramble captions={captions} />
</AbsoluteFill>
);A monospaced font keeps the decoding glyphs exactly as wide as the letters they replace. With a proportional font the glyphs can run slightly past the word for a frame or two while it resolves.
How it animates
The page enters with a short fade and a small rise (160 ms). A word stays hidden until its
startMs, then shows random glyphs that resolve into the real letters from left to right over the
time the word is spoken, capped at 300 ms. The glyphs come from A–Z, 0–9 and #%&*/+= and
re-roll every two frames. When the speaker pauses, the page fades out over 220 ms.
The glyph set is the GLYPHS constant at the top of the file, with no prop: edit the copied source
for katakana, binary or other characters. There is no cursor and no font of its own. For a terminal
look, pass a monospace font through className and set color and glyphColor, for example a
phosphor green.
Dependencies
npx shadcn@latest add @remocn/caption-scramble copies the component into components/remocn/ together with
the shared helpers it imports (caption-core, glide, frame-rate). The npm dependencies are remotion and
@remotion/captions; install the second with npx remotion add @remotion/captions so it matches
your Remotion version. No font is bundled: the caption inherits the font of its parent, so load one
with @remotion/google-fonts and set it on a wrapper or through className.
Props9
| Prop | Type | Default |
|---|---|---|
| captions | Caption[]— The timed transcript, in the `Caption` shape from `@remotion/captions`. Times are relative to the start of the surrounding `Sequence`. | |
| combineTokensWithinMilliseconds | number1200 How much speech one page may span before the next word starts a new page. Pages also break at the end of a sentence and on any pause of at least `holdMs` (300 ms minimum). | |
| holdMs | number600 How long a page stays after its last word when the next page is not already due. It fades out at the end of the hold. | |
| glyphColor | string"#a3a3a3" Colour of the glyphs that have not resolved yet. Resolved letters use `color`. | |
| fontSize | number64 Font size in pixels. | |
| fontWeight | number800 Font weight. The font itself is inherited. | |
| color | string"#ffffff" Colour of resolved letters. | |
| shadow | booleantrue A tight text shadow that keeps the caption legible over bright footage. | |
| className | string— Classes for the text block — width, font family, `uppercase`. | |
- captionsCaption[]
The timed transcript, in the `Caption` shape from `@remotion/captions`. Times are relative to the start of the surrounding `Sequence`.
Default
— - combineTokensWithinMillisecondsnumber
How much speech one page may span before the next word starts a new page. Pages also break at the end of a sentence and on any pause of at least `holdMs` (300 ms minimum).
Default
1200 - holdMsnumber
How long a page stays after its last word when the next page is not already due. It fades out at the end of the hold.
Default
600 - glyphColorstring
Colour of the glyphs that have not resolved yet. Resolved letters use `color`.
Default
"#a3a3a3" - fontSizenumber
Font size in pixels.
Default
64 - fontWeightnumber
Font weight. The font itself is inherited.
Default
800 - colorstring
Colour of resolved letters.
Default
"#ffffff" - shadowboolean
A tight text shadow that keeps the caption legible over bright footage.
Default
true - classNamestring
Classes for the text block — width, font family, `uppercase`.
Default
—