Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

3.7 KB
Raw Blame
---
title: Glass Code Walk
description: A camera that scans a glass code block top to bottom as it types, then pulls back to a centered hold
component: glass-code-walk
vibe: tech
length: 150
useWhen:
  - "A code reveal needs camera motion — the frame stays pinned to the line currently typing, then pulls back so the whole file lands as the payoff."
  - "The snippet is too small to read at full frame and you want it magnified (2.6× by default) while it types."
  - "The scene already has a background image or shader and the glass panel should refract it while the camera moves over it."
avoidWhen:
  - "The code panel should sit still in frame with no camera move — use `glass-code-block`, which this component wraps and animates."
  - "The point is code producing live UI side by side — use `live-code-compilation`, which types styles and applies them to a rendered button."
  - "The content is shell commands and output rather than a source file — use `terminal-simulator`, or `terminal-cursor-zoom` for the same camera treatment on a single command."
askedAs:
  - "camera scanning code top to bottom"
  - "code panel with camera move"
  - "I want the camera to travel down a glass code block as it types then pull back"
  - "long code snippet explored with a moving viewpoint"
  - "cinematic code demo that guides eyes across lines before settling"
  - "walkthrough of a source file with a cinematic scan and a final centered hold"
---

<ComponentPreview name="glass-code-walk" />

<InstallBlock name="glass-code-walk" />

## Usage

```tsx
// src/Root.tsx
import { Composition } from "remotion";
import { GlassCodeWalk } from "@/components/remocn/glass-code-walk";

const GlassCodeWalkScene = () => (
  <GlassCodeWalk
    title="scene.tsx"
    code={`export function Intro() {\n  return <h1>Ship it</h1>;\n}`}
  />
);

export const RemotionRoot = () => (
  <Composition
    id="GlassCodeWalk"
    component={GlassCodeWalkScene}
    durationInFrames={150}
    fps={30}
    width={1280}
    height={720}
  />
);
```

The camera mirrors `glass-code-block`'s line layout to keep the revealing line pinned, so it pairs with that component — `npx shadcn add @remocn/glass-code-walk` pulls it in automatically. Renders transparent; supply the background with `Backdrop` so the glass has an image to refract.

<PropsTable title="Props"
  rows={[
    {
      name: "code",
      type: "string",
      description: "Source code to render. Newlines split into lines the camera scans.",
    },
    {
      name: "title",
      type: "string",
      default: "\"scene.tsx\"",
      description: "Filename shown in the chrome bar",
    },
    {
      name: "width",
      type: "number",
      default: "880",
      description: "Glass block width in pixels; centering and the camera pin derive from it",
    },
    {
      name: "height",
      type: "number",
      default: "420",
      description: "Glass block height in pixels",
    },
    {
      name: "fontSize",
      type: "number",
      default: "18",
      description: "Code font size in pixels; line geometry is derived from it",
    },
    {
      name: "staggerFrames",
      type: "number",
      default: "10",
      description: "Frames between each line's reveal; the camera scan tracks the same cadence",
    },
    {
      name: "zoom",
      type: "number",
      default: "2.6",
      description: "Camera scale while scanning before the pull-back to centered",
    },
    {
      name: "speed",
      type: "number",
      default: "1",
      description: "Playback multiplier applied to both the reveal and the camera",
    },
    {
      name: "className",
      type: "string",
      description: "Optional className passed to the outer container",
    },
  ]}
/>