Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: added new component terminal cursor zoom
dev_wandry5af669b05866
diff --git a/content/docs/components.mdx b/content/docs/components.mdxindex 43f79870..65d53e7d 100644--- a/content/docs/components.mdx+++ b/content/docs/components.mdx@@ -288,6 +288,12 @@ Pre-assembled interface elements: code editors, layouts, charts, and workflow vistatus: "stable",href: "/docs/ui-blocks/terminal-simulator",},+ {+ name: "TerminalCursorZoom",+ description: "Camera rides the typing cursor, dollying across a terminal as a command types at high zoom",+ status: "stable",+ href: "/docs/ui-blocks/terminal-cursor-zoom",+ },{name: "CodeAccordion",description: "Long code blocks collapse mid-section, hiding noise behind a count badge",diff --git a/content/docs/ui-blocks/index.mdx b/content/docs/ui-blocks/index.mdxindex 6f441c84..b5801d28 100644--- a/content/docs/ui-blocks/index.mdx+++ b/content/docs/ui-blocks/index.mdx@@ -21,6 +21,12 @@ Larger blocks built from primitives, the actual surfaces your viewers will recogstatus: "stable",href: "/docs/ui-blocks/terminal-simulator",},+ {+ name: "TerminalCursorZoom",+ description: "Camera rides the typing cursor, dollying across a terminal as a command types at high zoom",+ status: "stable",+ href: "/docs/ui-blocks/terminal-cursor-zoom",+ },{name: "CodeAccordion",description: "Long code blocks collapse mid-section, hiding noise behind a count badge",diff --git a/content/docs/ui-blocks/meta.json b/content/docs/ui-blocks/meta.jsonindex 88e5641d..2c09724b 100644--- a/content/docs/ui-blocks/meta.json+++ b/content/docs/ui-blocks/meta.json@@ -5,6 +5,7 @@"index","glass-code-block","terminal-simulator",+ "terminal-cursor-zoom","code-accordion","code-diff-wipe","tool-menu-slide-in",diff --git a/content/docs/ui-blocks/terminal-cursor-zoom.mdx b/content/docs/ui-blocks/terminal-cursor-zoom.mdxnew file mode 100644index 00000000..6d90c577--- /dev/null+++ b/content/docs/ui-blocks/terminal-cursor-zoom.mdx@@ -0,0 +1,95 @@+---+title: Terminal Cursor Zoom+description: Camera locked to the typing cursor, dollying across a terminal as a command types at high zoom+---++<ComponentPreview name="terminal-cursor-zoom" />++## Installation++<InstallBlock name="terminal-cursor-zoom" />++## Usage++```tsx+// src/Root.tsx+import { Composition } from "remotion";+import { TerminalCursorZoom } from "@/components/remocn/terminal-cursor-zoom";++const TerminalCursorZoomScene = () => (+ <TerminalCursorZoom command="npx shadcn add @remocn/terminal-simulator" />+);++export const RemotionRoot = () => (+ <Composition+ id="TerminalCursorZoom"+ component={TerminalCursorZoomScene}+ durationInFrames={90}+ fps={30}+ width={1280}+ height={720}+ />+);+```++The camera reads `terminal-simulator`'s fixed layout to keep the cursor pinned, so it pairs with that component — `npx shadcn add @remocn/terminal-cursor-zoom` pulls it in automatically.++## Props++<PropsTable+ rows={[+ {+ name: "command",+ type: "string",+ default: "\"npx shadcn add @remocn/terminal-cursor-zoom\"",+ description: "The single command line typed out and tracked by the camera",+ },+ {+ name: "zoom",+ type: "number",+ default: "2.8",+ description: "Camera scale while the cursor is pinned to screen center",+ },+ {+ name: "fontSize",+ type: "number",+ default: "20",+ description: "Monospace font size in pixels; the cursor geometry is derived from it",+ },+ {+ name: "prompt",+ type: "string",+ default: "\"$\"",+ description: "Prompt prefix shown before the command",+ },+ {+ name: "title",+ type: "string",+ default: "\"~/code/remocn-demo\"",+ description: "Title shown in the terminal window chrome",+ },+ {+ name: "charsPerFrame",+ type: "number",+ default: "1",+ description: "Typing speed passed through to the terminal; the camera mirrors it exactly",+ },+ {+ name: "chunkSize",+ type: "number",+ default: "1",+ description: "Characters revealed per step; the camera snaps to the same chunking",+ },+ {+ name: "speed",+ type: "number",+ default: "1",+ description: "Playback multiplier applied to both the typing and the camera",+ },+ {+ name: "className",+ type: "string",+ description: "Optional className passed to the outer container",+ },+ ]}+/>diff --git a/registry/__index__.tsx b/registry/__index__.tsxindex 6eda3f2c..624d1344 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -123,6 +123,8 @@ import { StaggeredFadeUp } from "@/registry/remocn/staggered-fade-up";import { staggeredFadeUpConfig } from "@/registry/remocn/staggered-fade-up/config";import { StrikethroughReplace } from "@/registry/remocn/strikethrough-replace";import { strikethroughReplaceConfig } from "@/registry/remocn/strikethrough-replace/config";+import { TerminalCursorZoom } from "@/registry/remocn/terminal-cursor-zoom";+import { terminalCursorZoomConfig } from "@/registry/remocn/terminal-cursor-zoom/config";import { TerminalSimulator } from "@/registry/remocn/terminal-simulator";import { terminalSimulatorConfig } from "@/registry/remocn/terminal-simulator/config";import { TerminalToBrowserDeploy } from "@/registry/remocn/terminal-to-browser-deploy";@@ -324,6 +326,10 @@ const registry: Record<string, RegistryEntry> = {Component: TerminalSimulator,config: terminalSimulatorConfig,},+ "terminal-cursor-zoom": {+ Component: TerminalCursorZoom,+ config: terminalCursorZoomConfig,+ },"code-diff-wipe": { Component: CodeDiffWipe, config: codeDiffWipeConfig },"drag-and-drop-flow": {Component: DragAndDropFlow,diff --git a/registry/remocn/registry.json b/registry/remocn/registry.jsonindex a4064164..e3a1c3b6 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -631,6 +631,25 @@}]},+ {+ "name": "terminal-cursor-zoom",+ "type": "registry:component",+ "title": "Terminal Cursor Zoom",+ "description": "Camera locked to the typing cursor, dollying across a terminal as a command types at high zoom.",+ "dependencies": [+ "remotion"+ ],+ "registryDependencies": [+ "@remocn/terminal-simulator"+ ],+ "files": [+ {+ "path": "terminal-cursor-zoom/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/terminal-cursor-zoom.tsx"+ }+ ]+ },{"name": "code-diff-wipe","type": "registry:component",diff --git a/registry/remocn/terminal-cursor-zoom/config.ts b/registry/remocn/terminal-cursor-zoom/config.tsnew file mode 100644index 00000000..bbf96c06--- /dev/null+++ b/registry/remocn/terminal-cursor-zoom/config.ts@@ -0,0 +1,36 @@+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const terminalCursorZoomConfig: ComponentConfig = {+ componentName: "TerminalCursorZoom",+ importPath: "@/components/remocn/terminal-cursor-zoom",+ controls: {+ command: {+ type: "text",+ default: "npx shadcn add @remocn/terminal-cursor-zoom",+ label: "Command",+ },+ zoom: {+ type: "number",+ default: 2.8,+ min: 1,+ max: 4,+ step: 0.1,+ label: "Zoom",+ },+ fontSize: {+ type: "number",+ default: 20,+ min: 10,+ max: 32,+ step: 1,+ label: "Font size",+ },+ prompt: { type: "text", default: "$", label: "Prompt" },+ title: { type: "text", default: "~/code/remocn-demo", label: "Title" },+ },+ durationInFrames: 90,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+ previewBackdrop: { type: "color", value: "#0B0B0C" },+};diff --git a/registry/remocn/terminal-cursor-zoom/index.tsx b/registry/remocn/terminal-cursor-zoom/index.tsxnew file mode 100644index 00000000..20b813ab--- /dev/null+++ b/registry/remocn/terminal-cursor-zoom/index.tsx@@ -0,0 +1,91 @@+"use client";++import { AbsoluteFill, interpolate, useCurrentFrame } from "remotion";++import { TerminalSimulator } from "@/components/remocn/terminal-simulator";++export interface TerminalCursorZoomProps {+ command?: string;+ zoom?: number;+ fontSize?: number;+ prompt?: string;+ title?: string;+ charsPerFrame?: number;+ chunkSize?: number;+ speed?: number;+ className?: string;+}++const STAGE_WIDTH = 1280;+const STAGE_HEIGHT = 720;+const WINDOW_WIDTH = 900;+const WINDOW_HEIGHT = 480;+const CONTENT_PADDING = 20;+const CHROME_HEIGHT = 40;+const PROMPT_GAP = 8;+const FIRST_LINE_FRAME = 10;++export function TerminalCursorZoom({+ command = "npx shadcn add @remocn/terminal-cursor-zoom",+ zoom = 2.8,+ fontSize = 20,+ prompt = "$",+ title = "~/code/remocn-demo",+ charsPerFrame = 1,+ chunkSize = 1,+ speed = 1,+ className,+}: TerminalCursorZoomProps) {+ const frame = useCurrentFrame();++ const charWidth = fontSize * 0.6;+ const windowLeft = (STAGE_WIDTH - WINDOW_WIDTH) / 2;+ const windowTop = (STAGE_HEIGHT - WINDOW_HEIGHT) / 2;+ const textStartX =+ windowLeft + CONTENT_PADDING + prompt.length * charWidth + PROMPT_GAP;+ const lineHeight = Math.round(fontSize * 1.6);+ const cursorY = windowTop + CHROME_HEIGHT + CONTENT_PADDING + lineHeight / 2;++ const lineStart = Math.round(FIRST_LINE_FRAME / speed);+ const localFrame = (frame - lineStart) * speed;+ const linearRevealed = Math.floor(+ interpolate(localFrame, [0, command.length / charsPerFrame], [0, command.length], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ }),+ );+ const revealed = Math.min(+ command.length,+ Math.ceil(linearRevealed / chunkSize) * chunkSize,+ );++ const cursorX = textStartX + revealed * charWidth;+ const tx = STAGE_WIDTH / 2 - zoom * cursorX;+ const ty = STAGE_HEIGHT / 2 - zoom * cursorY;++ 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(${zoom})`,+ transformOrigin: "0 0",+ }}+ >+ <TerminalSimulator+ lines={[{ text: command, type: "command", delay: 0 }]}+ prompt={prompt}+ title={title}+ fontSize={fontSize}+ charsPerFrame={charsPerFrame}+ chunkSize={chunkSize}+ speed={speed}+ />+ </div>+ </AbsoluteFill>+ );+}diff --git a/registry/remocn/terminal-simulator/config.ts b/registry/remocn/terminal-simulator/config.tsindex 094a11dd..19c88147 100644--- a/registry/remocn/terminal-simulator/config.ts+++ b/registry/remocn/terminal-simulator/config.ts@@ -37,4 +37,5 @@ export const terminalSimulatorConfig: ComponentConfig = {fps: FPS,compositionWidth: W,compositionHeight: H,+ previewBackdrop: { type: "color", value: "#050505" },};diff --git a/registry/remocn/terminal-simulator/index.tsx b/registry/remocn/terminal-simulator/index.tsxindex 09047f12..35b39d85 100644--- a/registry/remocn/terminal-simulator/index.tsx+++ b/registry/remocn/terminal-simulator/index.tsx@@ -119,7 +119,6 @@ export function TerminalSimulator({display: "flex",alignItems: "center",justifyContent: "center",- background: "#050505",}}><divdiff --git a/tsconfig.json b/tsconfig.jsonindex a529f6f0..9f7d2d88 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -38,6 +38,7 @@"@/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/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"],"@/*": ["./*"]}