matrix-decode
remotionui/matrix-decodeFreeComponent
Scramble resolves left-to-right into target text
Live preview
live · rendered by the registry
Rendered by remotionui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://remotionui.com/r/matrix-decode.jsonSource
1import { interpolate, useCurrentFrame, useVideoConfig } from "remotion";2import { scaleFont } from "@/remotion/lib/layout";34export type MatrixDecodeProps = {5 text: string;6 durationInFrames?: number;7 delayInFrames?: number;8 fontSize?: number;9 color?: string;10 fontWeight?: number;11 fontFamily?: string;12};1314const GLYPHS = "アイウエオカキクケコサシスセソ0123456789";1516function scrambleChar(target: string, progress: number, index: number): string {17 if (progress >= 1) return target;18 const resolved = Math.floor(progress * target.length);19 if (index < resolved) return target[index] ?? "";20 const seed = (index * 17 + Math.floor(progress * 40)) % GLYPHS.length;21 return GLYPHS[seed] ?? target;22}2324export const MatrixDecode: React.FC<MatrixDecodeProps> = ({25 text,26 durationInFrames = 50,27 delayInFrames = 0,28 fontSize: fontSizeProp,29 color = "#2dd4bf",30 fontWeight = 600,31 fontFamily,32}) => {33 const frame = useCurrentFrame();34 const { width } = useVideoConfig();35 const fontSize = fontSizeProp ?? scaleFont(72, width);36 const progress = interpolate(37 frame,38 [delayInFrames, delayInFrames + durationInFrames],39 [0, 1],40 { extrapolateLeft: "clamp", extrapolateRight: "clamp" },41 );42 const decoded = Array.from(text, (char, index) =>43 char === " " ? " " : scrambleChar(char, progress, index),44 ).join("");4546 return (47 <span48 style={{49 fontSize,50 fontWeight,51 color,52 lineHeight: 1.2,53 fontFamily: fontFamily ?? "ui-monospace, monospace",54 }}55 >56 {decoded}57 </span>58 );59};
More from remotionui
All 127 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| audio-pulseaudio-pulse | remotionui | Components | Free | no deps | |
| audiogram-barsaudiogram-bars | remotionui | Components | Free | no deps | |
| blur-focus-inblur-focus-in | remotionui | Components | Free | no deps | |
| blur-inblur-in | remotionui | Components | Free | no deps | |
| blur-revealblur-reveal | remotionui | Components | Free | no deps | |
| caption-highlightcaption-highlight | remotionui | Components | Free | no deps | |
| chromatic-aberration-wipechromatic-aberration-wipe | remotionui | Components | Free | no deps | |
| confetti-burstconfetti-burst | remotionui | Components | Free | no deps |
