code-reveal
remotionui/code-revealFreeBlock
Editor window that writes a syntax-highlighted file character by character, then focuses the lines that matter
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/code-reveal.jsonSource
1import { loadFont } from "@remotion/google-fonts/JetBrainsMono";2import {3 interpolate,4 spring,5 useCurrentFrame,6 useVideoConfig,7} from "remotion";8import { Caret, stageScale } from "@/remotion/lib/ai-composer-utils";9import {10 CODE_THEMES,11 CodeLine,12 lineLength,13 MONO_ADVANCE,14 tokenizeCode,15} from "@/remotion/lib/code-syntax";16import { EASING } from "@/remotion/lib/motion-tokens";1718const { fontFamily } = loadFont("normal", {19 weights: ["400", "500", "700"],20 subsets: ["latin"],21});2223/** Reference stage the editor is laid out against, then uniformly scaled. */24const REF_WIDTH = 1280;25const REF_HEIGHT = 720;2627const WINDOW_WIDTH = 940;28const HEADER_HEIGHT = 46;29const BODY_PADDING = 24;30const ROW_HEIGHT = 34;31const FONT_SIZE = 21;32const GUTTER_WIDTH = 62;33const CODE_INSET = 20;34/** Longest listing shown at once — anything past this scrolls. */35const MAX_VISIBLE_ROWS = 10;3637/** Characters per second the code is written at. */38const WRITE_CPS = 55;39/** Beat spent moving to the next line, in seconds. */40const NEWLINE_PAUSE = 0.07;4142const DEFAULT_CODE = `import { CodeReveal } from "@/remotion/scenes/code-reveal";4344export const Explainer = () => (45 <CodeReveal46 title="pipeline.ts"47 highlightedLines={[4, 5]}48 />49);`;5051export type CodeRevealProps = {52 /** Source shown in the editor. Surrounding blank lines are trimmed. */53 code?: string;54 /** 1-based line numbers focused once the listing finishes writing. */55 highlightedLines?: number[];56 /** Filename on the editor tab. */57 title?: string;58 /** Language badge on the right of the header. */59 language?: string;60 /** First line number in the gutter — set it when showing an excerpt. */61 startLine?: number;62 /** Hides the gutter entirely when false. */63 showLineNumbers?: boolean;64 accentColor?: string;65 /** Overrides the page background behind the window. */66 backgroundColor?: string;67 theme?: "dark" | "light";68 /** Animation speed multiplier. */69 speed?: number;70};7172const CHROME_LIGHTS = ["#FF5F57", "#FEBC2E", "#28C840"] as const;7374/**75 * Code reveal staged as an editor actually writing the file: a write head runs76 * through the listing character by character with the caret riding its tip,77 * then — once the file is complete — attention lands on the lines that matter78 * and the rest of the listing recedes.79 */80export const CodeReveal: React.FC<CodeRevealProps> = ({81 code = DEFAULT_CODE,82 highlightedLines = [],83 title = "explainer.tsx",84 language = "tsx",85// … truncated
More from remotionui
All 127 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-composer-showcaseai-composer-showcase | remotionui | Blocks | Free | no deps | |
| ai-generation-canvasai-generation-canvas | remotionui | Blocks | Free | no deps | |
| animated-bar-chartanimated-bar-chart | remotionui | Blocks | Free | no deps | |
| audiogram-sceneaudiogram-scene | remotionui | Blocks | Free | no deps | |
| auto-fit-titleauto-fit-title | remotionui | Blocks | Free | no deps | |
| b-roll-stackb-roll-stack | remotionui | Blocks | Free | no deps | |
| bento-panbento-pan | remotionui | Blocks | Free | no deps | |
| browser-flowbrowser-flow | remotionui | Blocks | Free | no deps |
