Skip to content

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

feat: added opencode

dev_wandryf084084e59c5
diff --git a/content/docs/ui-blocks/meta.json b/content/docs/ui-blocks/meta.json
index b03a60ce..32ea04e6 100644
--- a/content/docs/ui-blocks/meta.json
+++ b/content/docs/ui-blocks/meta.json
@@ -12,6 +12,7 @@
"chat-gpt",
"v0",
"claude-code",
+ "opencode",
"animated-line-chart",
"animated-bar-chart",
"drag-and-drop-flow"
diff --git a/content/docs/ui-blocks/opencode.mdx b/content/docs/ui-blocks/opencode.mdx
new file mode 100644
index 00000000..05d9dd3b
--- /dev/null
+++ b/content/docs/ui-blocks/opencode.mdx
@@ -0,0 +1,118 @@
+---
+title: OpenCode
+description: Animated OpenCode TUI welcome screen that types a query into the input
+---
+
+<ComponentPreview name="opencode" />
+
+## Installation
+
+<InstallBlock name="opencode" />
+
+<Note>
+ Installing `opencode` pulls the `caret` primitive and the `remocn-ui` core lib (which provides the shared `useTypewriter` hook) via `registryDependencies`, plus the `JetBrains Mono` font via `@remotion/google-fonts` automatically. No additional install needed.
+</Note>
+
+## Usage
+
+Standalone in a Remotion `<Composition>` — renders immediately after install:
+
+```tsx
+// src/Root.tsx
+import { Composition } from "remotion";
+import { OpenCode } from "@/components/remocn/opencode";
+
+const OpenCodeScene = () => (
+ <OpenCode
+ placeholder="Ask anything... "
+ query="What is the tech stack of this project?"
+ agentName="Build"
+ modelName="Kimi K2.5"
+ provider="Moonshot AI"
+ accentColor="#2B7FFF"
+ theme="dark"
+ background="surface"
+ speed={1}
+ />
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="OpenCode"
+ component={OpenCodeScene}
+ durationInFrames={150}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);
+```
+
+Timeline: wordmark + input box + hints ease in (0–18), default state with the block cursor blinking holds (18–48), the query types into the input from frame 48, then holds to the end.
+
+## Props
+
+<PropsTable
+ rows={[
+ {
+ name: "placeholder",
+ type: "string",
+ default: "\"Ask anything... \"",
+ description: "Muted prompt prefix before the query",
+ },
+ {
+ name: "query",
+ type: "string",
+ default: '"What is the tech stack of this project?"',
+ description: "The text that types in character-by-character",
+ },
+ {
+ name: "agentName",
+ type: "string",
+ default: "\"Build\"",
+ description: "Agent label in the status line shown in the accent color",
+ },
+ {
+ name: "modelName",
+ type: "string",
+ default: "\"Kimi K2.5\"",
+ description: "Model name in the status line",
+ },
+ {
+ name: "provider",
+ type: "string",
+ default: "\"Moonshot AI\"",
+ description: "Provider name in the status line",
+ },
+ {
+ name: "accentColor",
+ type: "string",
+ default: "\"#2B7FFF\"",
+ description: "Blue accent bar and agent label color",
+ },
+ {
+ name: "theme",
+ type: "\"light\" | \"dark\"",
+ default: "\"dark\"",
+ description: "Dark or light theme",
+ },
+ {
+ name: "background",
+ type: "\"surface\" | \"transparent\"",
+ default: "\"surface\"",
+ description: "Page background fill or transparent",
+ },
+ {
+ name: "speed",
+ type: "number",
+ default: "1",
+ description: "Animation speed multiplier (minimum 1 so the query finishes typing)",
+ },
+ ]}
+/>
+
+## Notes
+
+- **Dark by default:** Defaults to the dark OpenCode look.
+- **Offline-friendly:** No network requests or images are used, so the preview works offline and MP4 export requires no CORS setup.
+- **Shared hook:** Reuses the `useTypewriter` hook and the `caret` primitive (rendered as a block cursor) shared with the other terminal and chat components.
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index 5c297cce..b65ffb66 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -107,6 +107,8 @@ import { V0 } from "@/registry/remocn/v0";
import { v0Config } from "@/registry/remocn/v0/config";
import { ClaudeCode } from "@/registry/remocn/claude-code";
import { claudeCodeConfig } from "@/registry/remocn/claude-code/config";
+import { OpenCode } from "@/registry/remocn/opencode";
+import { opencodeConfig } from "@/registry/remocn/opencode/config";
import { ClaudeChat } from "@/registry/remocn/claude-chat";
import { claudeChatConfig } from "@/registry/remocn/claude-chat/config";
import { Accordion } from "@/registry/remocn-ui/accordion";
@@ -341,6 +343,7 @@ const registry: Record<string, RegistryEntry> = {
"chat-gpt": { Component: ChatGpt, config: chatGptConfig },
"v0": { Component: V0, config: v0Config },
"claude-code": { Component: ClaudeCode, config: claudeCodeConfig },
+ "opencode": { Component: OpenCode, config: opencodeConfig },
"button": { Component: Button, config: buttonConfig },
"accordion": { Component: Accordion, config: accordionConfig },
"alert-dialog": { Component: AlertDialog, config: alertDialogConfig },
@@ -514,4 +517,16 @@ if (claudeCode) {
};
}
+const opencode = registry["opencode"];
+if (opencode) {
+ opencode.config.controls.speed = {
+ type: "number",
+ default: 1,
+ min: 1,
+ max: 4,
+ step: 0.25,
+ label: "Speed",
+ };
+}
+
export default registry;
diff --git a/registry/remocn/opencode/__tests__/opencode.test.ts b/registry/remocn/opencode/__tests__/opencode.test.ts
new file mode 100644
index 00000000..45ce0f2d
--- /dev/null
+++ b/registry/remocn/opencode/__tests__/opencode.test.ts
@@ -0,0 +1,38 @@
+import { describe, expect, it } from "vitest";
+
+import { THEMES, TYPING_CPS, TYPING_START_FRAME } from "../index";
+
+describe("typing constants", () => {
+ it("starts typing on a positive frame offset", () => {
+ expect(TYPING_START_FRAME).toBeGreaterThan(0);
+ });
+
+ it("types at a positive characters-per-second rate", () => {
+ expect(TYPING_CPS).toBeGreaterThan(0);
+ });
+});
+
+describe("THEMES", () => {
+ it("exposes dark and light entries", () => {
+ expect(THEMES.dark).toBeDefined();
+ expect(THEMES.light).toBeDefined();
+ });
+
+ it("has non-empty string fields for every theme entry", () => {
+ const fields = [
+ "page",
+ "boxBg",
+ "fg",
+ "fgMuted",
+ "fgQuery",
+ "logoOpen",
+ "logoCode",
+ ] as const;
+ for (const theme of Object.values(THEMES)) {
+ for (const field of fields) {
+ expect(typeof theme[field]).toBe("string");
+ expect(theme[field].length).toBeGreaterThan(0);
+ }
+ }
+ });
+});
diff --git a/registry/remocn/opencode/config.ts b/registry/remocn/opencode/config.ts
new file mode 100644
index 00000000..5ea92ead
--- /dev/null
+++ b/registry/remocn/opencode/config.ts
@@ -0,0 +1,38 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const opencodeConfig: ComponentConfig = {
+ componentName: "OpenCode",
+ importPath: "@/components/remocn/opencode",
+ controls: {
+ placeholder: {
+ type: "text",
+ default: "Ask anything... ",
+ label: "Placeholder",
+ },
+ query: {
+ type: "text",
+ default: '"What is the tech stack of this project?"',
+ label: "Query",
+ },
+ agentName: { type: "text", default: "Build", label: "Agent" },
+ modelName: { type: "text", default: "Kimi K2.5", label: "Model" },
+ provider: { type: "text", default: "Moonshot AI", label: "Provider" },
+ accentColor: { type: "color", default: "#2B7FFF", label: "Accent" },
+ theme: {
+ type: "select",
+ default: "dark",
+ options: ["light", "dark"],
+ label: "Theme",
+ },
+ background: {
+ type: "select",
+ default: "surface",
+ options: ["surface", "transparent"],
+ label: "Background",
+ },
+ },
+ durationInFrames: 150,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+};
diff --git a/registry/remocn/opencode/index.tsx b/registry/remocn/opencode/index.tsx
new file mode 100644
index 00000000..0fe93d33
--- /dev/null
+++ b/registry/remocn/opencode/index.tsx
@@ -0,0 +1,286 @@
+"use client";
+
+import { loadFont } from "@remotion/google-fonts/JetBrainsMono";
+import {
+ AbsoluteFill,
+ interpolate,
+ spring,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
+import { Caret } from "@/components/remocn/caret";
+import { useTypewriter } from "@/lib/remocn-ui";
+
+const { fontFamily: MONO_FAMILY } = loadFont();
+
+export interface OpenCodeProps {
+ placeholder?: string;
+ query?: string;
+ agentName?: string;
+ modelName?: string;
+ provider?: string;
+ accentColor?: string;
+ theme?: "light" | "dark";
+ background?: "surface" | "transparent";
+ speed?: number;
+}
+
+interface Theme {
+ page: string;
+ boxBg: string;
+ fg: string;
+ fgMuted: string;
+ fgQuery: string;
+ logoOpen: string;
+ logoCode: string;
+}
+
+export const THEMES: Record<"light" | "dark", Theme> = {
+ light: {
+ page: "#FFFFFF",
+ boxBg: "#F2F2F2",
+ fg: "#111111",
+ fgMuted: "#888888",
+ fgQuery: "#555555",
+ logoOpen: "#999999",
+ logoCode: "#111111",
+ },
+ dark: {
+ page: "#000000",
+ boxBg: "#161616",
+ fg: "#EDEDED",
+ fgMuted: "#6B6B6B",
+ fgQuery: "#9A9A9A",
+ logoOpen: "#6B6B6B",
+ logoCode: "#EDEDED",
+ },
+};
+
+export const TYPING_START_FRAME = 48;
+
+export const TYPING_CPS = 20;
+
+function introBounceIn(
+ frame: number,
+ fps: number,
+): { translateY: number; scale: number } {
+ const s = spring({
+ fps,
+ frame,
+ config: { damping: 14, stiffness: 110, mass: 0.7 },
+ });
+ const translateY = interpolate(s, [0, 1], [28, 0]);
+ const scale = interpolate(s, [0, 1], [0.97, 1]);
+ return { translateY, scale };
+}
+
+function fadeUpAt(
+ frame: number,
+ range: [number, number],
+): { opacity: number; translateY: number } {
+ const opts = {
+ extrapolateLeft: "clamp" as const,
+ extrapolateRight: "clamp" as const,
+ };
+ return {
+ opacity: interpolate(frame, range, [0, 1], opts),
+ translateY: interpolate(frame, range, [12, 0], opts),
+ };
+}
+
+export function OpenCode({
+ placeholder = "Ask anything... ",
+ query = '"What is the tech stack of this project?"',
+ agentName = "Build",
+ modelName = "Kimi K2.5",
+ provider = "Moonshot AI",
+ accentColor = "#2B7FFF",
+ theme = "dark",
+ background = "surface",
+ speed = 1,
+}: OpenCodeProps) {
+ const frame = useCurrentFrame();
+ const { width, height, fps } = useVideoConfig();
+ const t = THEMES[theme] ?? THEMES.dark;
+
+ const refW = 1280;
+ const refH = 720;
+ const stageScale = Math.min(width / refW, height / refH);
+
+ const tw = useTypewriter(query, {
+ cps: TYPING_CPS,
+ speed,
+ startFrame: TYPING_START_FRAME,
+ });
+
+ const intro = introBounceIn(frame * speed, fps);
+ const logoFade = fadeUpAt(frame * speed, [4, 22]);
+ const boxFade = fadeUpAt(frame * speed, [12, 30]);
+ const hintsFade = fadeUpAt(frame * speed, [20, 38]);
+
+ const pageBg = background === "transparent" ? "transparent" : t.page;
+
+ const boxWidth = 1000;
+
+ return (
+ <AbsoluteFill style={{ background: pageBg }}>
+ <div
+ style={{
+ position: "absolute",
+ left: "50%",
+ top: "50%",
+ width: refW,
+ height: refH,
+ transform: `translate(-50%, -50%) scale(${stageScale})`,
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <div
+ style={{
+ lineHeight: 0,
+ opacity: logoFade.opacity,
+ transform: `translateY(${logoFade.translateY + intro.translateY * 0.4}px)`,
+ }}
+ >
+ <svg
+ width={468}
+ height={84}
+ viewBox="0 0 234 42"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <title>opencode</title>
+ <clipPath id="opencode-wordmark-clip">
+ <rect width={234} height={42} fill="#ffffff" />
+ </clipPath>
+ <g clipPath="url(#opencode-wordmark-clip)">
+ <path d="M18 30H6V18H18V30Z" fill="#4B4646" />
+ <path d="M18 12H6V30H18V12ZM24 36H0V6H24V36Z" fill="#B7B1B1" />
+ <path d="M48 30H36V18H48V30Z" fill="#4B4646" />
+ <path
+ d="M36 30H48V12H36V30ZM54 36H36V42H30V6H54V36Z"
+ fill="#B7B1B1"
+ />
+ <path d="M84 24V30H66V24H84Z" fill="#4B4646" />
+ <path
+ d="M84 24H66V30H84V36H60V6H84V24ZM66 18H78V12H66V18Z"
+ fill="#B7B1B1"
+ />
+ <path d="M108 36H96V18H108V36Z" fill="#4B4646" />
+ <path
+ d="M108 12H96V36H90V6H108V12ZM114 36H108V12H114V36Z"
+ fill="#B7B1B1"
+ />
+ <path d="M144 30H126V18H144V30Z" fill="#4B4646" />
+ <path
+ d="M144 12H126V30H144V36H120V6H144V12Z"
+ fill="#F1ECEC"
+ />
+ <path d="M168 30H156V18H168V30Z" fill="#4B4646" />
+ <path
+ d="M168 12H156V30H168V12ZM174 36H150V6H174V36Z"
+ fill="#F1ECEC"
+ />
+ <path d="M198 30H186V18H198V30Z" fill="#4B4646" />
+ <path
+ d="M198 12H186V30H198V12ZM204 36H180V6H198V0H204V36Z"
+ fill="#F1ECEC"
+ />
+ <path d="M234 24V30H216V24H234Z" fill="#4B4646" />
+ <path
+ d="M216 12V18H228V12H216ZM234 24H216V30H234V36H210V6H234V24Z"
+ fill="#F1ECEC"
+ />
+ </g>
+ </svg>
+ </div>
+
+ <div
+ style={{
+ width: boxWidth,
+ marginTop: 40,
+ minHeight: 150,
+ background: t.boxBg,
+ borderLeft: `4px solid ${accentColor}`,
+ padding: "26px 28px",
+ boxSizing: "border-box",
+ display: "flex",
+ flexDirection: "column",
+ justifyContent: "center",
+ gap: 26,
+ opacity: boxFade.opacity,
+ transform: `translateY(${boxFade.translateY + intro.translateY * 0.6}px) scale(${intro.scale})`,
+ transformOrigin: "center top",
+ }}
+ >
+ <div
+ style={{
+ display: "inline-flex",
+ alignItems: "center",
+ fontFamily: MONO_FAMILY,
+ fontSize: 22,
+ }}
+ >
+ <span style={{ color: t.fgMuted }}>{placeholder}</span>
+ {tw.count > 0 ? (
+ <span style={{ color: t.fgQuery }}>{tw.text}</span>
+ ) : null}
+ <span style={{ opacity: 0.6, display: "inline-flex" }}>
+ <Caret
+ width={12}
+ height={24}
+ color={t.fg}
+ blink={!tw.typing}
+ speed={speed}
+ marginLeft={2}
+ />
+ </span>
+ </div>
+
+ <div
+ style={{
+ display: "flex",
+ flexDirection: "row",
+ alignItems: "center",
+ gap: 16,
+ fontFamily: MONO_FAMILY,
+ fontSize: 20,
+ }}
+ >
+ <span style={{ color: accentColor, fontWeight: 600 }}>
+ {agentName}
+ </span>
+ <span style={{ color: t.fg }}>{modelName}</span>
+ <span style={{ color: t.fgMuted }}>{provider}</span>
+ </div>
+ </div>
+
+ <div
+ style={{
+ width: boxWidth,
+ marginTop: 18,
+ display: "flex",
+ justifyContent: "flex-end",
+ gap: 22,
+ fontFamily: MONO_FAMILY,
+ fontSize: 18,
+ opacity: hintsFade.opacity,
+ transform: `translateY(${hintsFade.translateY}px)`,
+ }}
+ >
+ <span style={{ display: "inline-flex", gap: 8 }}>
+ <span style={{ color: t.fg, fontWeight: 700 }}>tab</span>
+ <span style={{ color: t.fgMuted }}>agents</span>
+ </span>
+ <span style={{ display: "inline-flex", gap: 8 }}>
+ <span style={{ color: t.fg, fontWeight: 700 }}>ctrl+p</span>
+ <span style={{ color: t.fgMuted }}>commands</span>
+ </span>
+ </div>
+ </div>
+ </AbsoluteFill>
+ );
+}
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index a0a19a82..8bde16a5 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -766,6 +766,21 @@
}
]
},
+ {
+ "name": "opencode",
+ "type": "registry:component",
+ "title": "OpenCode",
+ "description": "Animated OpenCode TUI welcome screen — two-tone wordmark, an input box with a blue accent bar that types a query, a model status line, and command hints. Dark/light themes.",
+ "dependencies": ["remotion", "@remotion/google-fonts"],
+ "registryDependencies": ["@remocn/caret", "@remocn/remocn-ui"],
+ "files": [
+ {
+ "path": "opencode/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/opencode.tsx"
+ }
+ ]
+ },
{
"name": "confetti",
"type": "registry:component",