Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
---
title: Glass Code Block
description: A premium frosted-glass code editor window with a regex tokenizer and line-by-line stagger reveal
component: glass-code-block
vibe: tech
length: 180
useWhen:
- "A landing or hero scene needs an animated code backdrop that reads as \"premium dev tool.\""
- "You want to showcase a code snippet with a styled editor chrome and no interactive narrative."
- "The backdrop must stay transparent so the panel composites over a custom background."
avoidWhen:
- "The scene requires the code to be visibly typed out character by character — use `terminal-simulator` or `typewriter` instead."
askedAs:
- "frosted code editor window"
- "glassmorphism code snippet"
- "I want a premium translucent code panel with syntax colors revealing line by line"
- "show a code sample on a sleek glass card"
- "API or SDK launch that needs a beautiful snippet on screen"
- "developer hero moment presenting the install or usage code"
---
<ComponentPreview name="glass-code-block" />
<InstallBlock name="glass-code-block" />
## Usage
```tsx
// src/Root.tsx
import { Composition } from "remotion";
import { GlassCodeBlock } from "@/components/remocn/glass-code-block";
const GlassCodeBlockScene = () => (
<GlassCodeBlock
title="hero.tsx"
code={`export function Hero() {\n return <h1>Hello</h1>;\n}`}
/>
);
export const RemotionRoot = () => (
<Composition
id="GlassCodeBlock"
component={GlassCodeBlockScene}
durationInFrames={180}
fps={30}
width={1280}
height={720}
/>
);
```
### With Backdrop
Renders transparent — supply the background via `Backdrop`:
```tsx
import { Backdrop } from "@/components/remocn/backdrop";
import { GlassCodeBlock } from "@/components/remocn/glass-code-block";
<Backdrop fill={{ type: "color", value: "#0a0a0a" }}>
<GlassCodeBlock title="hero.tsx" code={`export function Hero() {\n return <h1>Hello</h1>;\n}`} />
</Backdrop>
```
<PropsTable title="Props"
rows={[
{
name: "code",
type: "string",
description: "Source code to render. Newlines split into lines.",
},
{
name: "title",
type: "string",
default: "\"hero.tsx\"",
description: "Filename shown in the chrome bar",
},
{
name: "width",
type: "number",
default: "760",
description: "Window width in pixels",
},
{
name: "height",
type: "number",
default: "460",
description: "Window height in pixels",
},
{
name: "fontSize",
type: "number",
default: "16",
description: "Code font size in pixels",
},
{
name: "glassColor",
type: "string",
default: "\"rgba(10, 10, 10, 0.6)\"",
description: "Card surface color. Keep alpha < 1 for glass refraction.",
},
{
name: "staggerFrames",
type: "number",
default: "4",
description: "Frames between each line's reveal",
},
{
name: "showTrafficLights",
type: "boolean",
default: "true",
description: "Show the dimmed macOS-style window controls",
},
{
name: "aura",
type: "boolean",
default: "false",
description: "Render an animated glow blob behind the glass. Leave off and supply a Backdrop image for the glass to refract.",
},
{
name: "speed",
type: "number",
default: "1",
description: "Playback speed multiplier",
},
{
name: "className",
type: "string",
description: "Optional className passed to the root container",
},
]}
/>