Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: added glass code block
dev_wandry4c80cb604779
diff --git a/content/docs/ui-blocks/glass-code-block.mdx b/content/docs/ui-blocks/glass-code-block.mdxindex ce2ce7ed..e1f0726c 100644--- a/content/docs/ui-blocks/glass-code-block.mdx+++ b/content/docs/ui-blocks/glass-code-block.mdx@@ -99,6 +99,12 @@ import { GlassCodeBlock } from "@/components/remocn/glass-code-block";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",diff --git a/content/docs/ui-blocks/glass-code-walk.mdx b/content/docs/ui-blocks/glass-code-walk.mdxnew file mode 100644index 00000000..b406fc5d--- /dev/null+++ b/content/docs/ui-blocks/glass-code-walk.mdx@@ -0,0 +1,97 @@+---+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+---++<ComponentPreview name="glass-code-walk" />++## Installation++<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.++## Props++<PropsTable+ 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",+ },+ ]}+/>diff --git a/content/docs/ui-blocks/meta.json b/content/docs/ui-blocks/meta.jsonindex 2c09724b..c3f653dd 100644--- a/content/docs/ui-blocks/meta.json+++ b/content/docs/ui-blocks/meta.json@@ -4,6 +4,7 @@"pages": ["index","glass-code-block",+ "glass-code-walk","terminal-simulator","terminal-cursor-zoom","code-accordion",diff --git a/registry/__index__.tsx b/registry/__index__.tsxindex 624d1344..5ec7ea79 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -73,6 +73,8 @@ import { LogoEnter } from "@/registry/remocn/logo-enter";import { logoEnterConfig } from "@/registry/remocn/logo-enter/config";import { GlassCodeBlock } from "@/registry/remocn/glass-code-block";import { glassCodeBlockConfig } from "@/registry/remocn/glass-code-block/config";+import { GlassCodeWalk } from "@/registry/remocn/glass-code-walk";+import { glassCodeWalkConfig } from "@/registry/remocn/glass-code-walk/config";import { GridPixelateWipe } from "@/registry/remocn/grid-pixelate-wipe";import { gridPixelateWipeConfig } from "@/registry/remocn/grid-pixelate-wipe/config";import { HeroDeviceAssemble } from "@/registry/remocn/hero-device-assemble";@@ -287,6 +289,10 @@ const registry: Record<string, RegistryEntry> = {Component: GlassCodeBlock,config: glassCodeBlockConfig,},+ "glass-code-walk": {+ Component: GlassCodeWalk,+ config: glassCodeWalkConfig,+ },"code-accordion": { Component: CodeAccordion, config: codeAccordionConfig },"data-flow-pipes": { Component: DataFlowPipes, config: dataFlowPipesConfig },"mesh-gradient-bg": {diff --git a/registry/remocn/glass-code-block/config.ts b/registry/remocn/glass-code-block/config.tsindex d7da0163..98326a91 100644--- a/registry/remocn/glass-code-block/config.ts+++ b/registry/remocn/glass-code-block/config.ts@@ -52,5 +52,5 @@ export const glassCodeBlockConfig: ComponentConfig = {fps: FPS,compositionWidth: W,compositionHeight: H,- previewBackdrop: { type: "color", value: "#0a0a0a" },+ previewBackdrop: { type: "image", src: "/bg.jpg" },};diff --git a/registry/remocn/glass-code-block/index.tsx b/registry/remocn/glass-code-block/index.tsxindex 213fd666..3aa8addc 100644--- a/registry/remocn/glass-code-block/index.tsx+++ b/registry/remocn/glass-code-block/index.tsx@@ -11,6 +11,7 @@ export interface GlassCodeBlockProps {glassColor?: string;staggerFrames?: number;showTrafficLights?: boolean;+ aura?: boolean;speed?: number;className?: string;}@@ -101,6 +102,7 @@ export function GlassCodeBlock({glassColor = "rgba(10, 10, 10, 0.6)",staggerFrames = 4,showTrafficLights = true,+ aura = false,speed = 1,className,}: GlassCodeBlockProps) {@@ -117,9 +119,7 @@ export function GlassCodeBlock({justifyContent: "center",}}>- {/* Animated background hint behind the glass so the blur has something- to chew on. Pure CSS — no extra deps. */}- <BackdropAura />+ {aura && <BackdropAura />}{/* 1px gradient ring acting as a microborder */}<divdiff --git a/registry/remocn/glass-code-walk/config.ts b/registry/remocn/glass-code-walk/config.tsnew file mode 100644index 00000000..54a8dd86--- /dev/null+++ b/registry/remocn/glass-code-walk/config.ts@@ -0,0 +1,54 @@+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const glassCodeWalkConfig: ComponentConfig = {+ componentName: "GlassCodeWalk",+ importPath: "@/components/remocn/glass-code-walk",+ controls: {+ title: { type: "text", default: "scene.tsx", label: "Title" },+ zoom: {+ type: "number",+ default: 2.6,+ min: 1,+ max: 4,+ step: 0.1,+ label: "Zoom",+ },+ fontSize: {+ type: "number",+ default: 18,+ min: 10,+ max: 28,+ step: 1,+ label: "Font size",+ },+ staggerFrames: {+ type: "number",+ default: 10,+ min: 1,+ max: 30,+ step: 1,+ label: "Stagger frames",+ },+ width: {+ type: "number",+ default: 880,+ min: 300,+ max: 1100,+ step: 10,+ label: "Width",+ },+ height: {+ type: "number",+ default: 420,+ min: 200,+ max: 700,+ step: 10,+ label: "Height",+ },+ },+ durationInFrames: 150,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+ previewBackdrop: { type: "image", src: "/bg.jpg" },+};diff --git a/registry/remocn/glass-code-walk/index.tsx b/registry/remocn/glass-code-walk/index.tsxnew file mode 100644index 00000000..35c25904--- /dev/null+++ b/registry/remocn/glass-code-walk/index.tsx@@ -0,0 +1,129 @@+"use client";++import { AbsoluteFill, Easing, interpolate, useCurrentFrame } from "remotion";++import { GlassCodeBlock } from "@/components/remocn/glass-code-block";++export interface GlassCodeWalkProps {+ code?: string;+ title?: string;+ width?: number;+ height?: number;+ fontSize?: number;+ staggerFrames?: number;+ zoom?: number;+ speed?: number;+ className?: string;+}++const STAGE_WIDTH = 1280;+const STAGE_HEIGHT = 720;+const RING = 1;+const CHROME_HEIGHT = 40;+const BODY_PADDING_TOP = 20;+const BODY_PADDING_LEFT = 24;+const LINE_GAP = 4;+const ANCHOR_SCREEN_X = 110;+const TARGET_Y = 360;+const PULL_BACK_FRAMES = 24;++const DEFAULT_CODE = `import { AbsoluteFill } from "remotion";+import { Typewriter } from "@/components/remocn";++export function Intro() {+ return (+ <AbsoluteFill>+ <Typewriter text="Ship it" />+ </AbsoluteFill>+ );+}`;++export function GlassCodeWalk({+ code = DEFAULT_CODE,+ title = "scene.tsx",+ width = 880,+ height = 420,+ fontSize = 18,+ staggerFrames = 10,+ zoom = 2.6,+ speed = 1,+ className,+}: GlassCodeWalkProps) {+ const frame = useCurrentFrame();++ const lines = code.split("\n");+ const lineCount = lines.length;++ const blockLeft = (STAGE_WIDTH - width) / 2;+ const blockTop = (STAGE_HEIGHT - height) / 2;+ const bodyTop = blockTop + RING + CHROME_HEIGHT + BODY_PADDING_TOP;++ const lineHeightOf = (line: string) =>+ line.trim() === "" ? fontSize * 0.8 : fontSize * 1.55;++ const lineCenters: number[] = [];+ let walk = bodyTop;+ for (const line of lines) {+ const h = lineHeightOf(line);+ lineCenters.push(walk + h / 2);+ walk += h + LINE_GAP;+ }++ const anchorWorldX = blockLeft + RING + BODY_PADDING_LEFT;+ const scanStagger = staggerFrames / speed;+ const scanEnd = (lineCount - 1) * scanStagger;++ const linePosition = interpolate(frame, [0, scanEnd], [0, lineCount - 1], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ });+ const lower = Math.floor(linePosition);+ const upper = Math.min(lower + 1, lineCount - 1);+ const trackedY =+ lineCenters[lower] ++ (lineCenters[upper] - lineCenters[lower]) * (linePosition - lower);++ const pinnedX = ANCHOR_SCREEN_X - zoom * anchorWorldX;+ const pinnedY = TARGET_Y - zoom * trackedY;++ const pullBack = interpolate(+ frame,+ [scanEnd, scanEnd + PULL_BACK_FRAMES / speed],+ [0, 1],+ {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ easing: Easing.inOut(Easing.cubic),+ },+ );++ const scale = zoom + pullBack * (1 - zoom);+ const tx = (1 - pullBack) * pinnedX;+ const ty = (1 - pullBack) * pinnedY;++ return (+ <AbsoluteFill className={className} style={{ overflow: "hidden" }}>+ <div+ style={{+ position: "absolute",+ left: 0,+ top: 0,+ width: STAGE_WIDTH,+ height: STAGE_HEIGHT,+ transform: `translate(${tx}px, ${ty}px) scale(${scale})`,+ transformOrigin: "0 0",+ }}+ >+ <GlassCodeBlock+ code={code}+ title={title}+ width={width}+ height={height}+ fontSize={fontSize}+ staggerFrames={staggerFrames}+ speed={speed}+ />+ </div>+ </AbsoluteFill>+ );+}diff --git a/registry/remocn/registry.json b/registry/remocn/registry.jsonindex e3a1c3b6..78b4198e 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -746,6 +746,25 @@}]},+ {+ "name": "glass-code-walk",+ "type": "registry:component",+ "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.",+ "dependencies": [+ "remotion"+ ],+ "registryDependencies": [+ "@remocn/glass-code-block"+ ],+ "files": [+ {+ "path": "glass-code-walk/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/glass-code-walk.tsx"+ }+ ]+ },{"name": "spotlight-card","type": "registry:component",diff --git a/tsconfig.json b/tsconfig.jsonindex 9f7d2d88..6ed9e858 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -37,6 +37,7 @@"@/components/remocn/use-slider-transition": ["./registry/remocn-ui/slider/use-slider-transition.ts"],"@/components/remocn/use-blur-in-transition": ["./registry/remocn-ui/blur-in/use-blur-in-transition.ts"],"@/components/remocn/confetti": ["./registry/remocn/confetti/index.tsx"],+ "@/components/remocn/glass-code-block": ["./registry/remocn/glass-code-block/index.tsx"],"@/components/remocn/number-wheel": ["./registry/remocn/number-wheel/index.tsx"],"@/components/remocn/terminal-simulator": ["./registry/remocn/terminal-simulator/index.tsx"],"@/components/remocn/*": ["./registry/remocn-ui/*/index.tsx"],