Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "caret-collapse",
"title": "Caret Collapse",
"description": "The typing caret in a prompt box collapses into the next scene.",
"dependencies": [
"remotion",
"@remotion/google-fonts",
"@remotion/transitions"
],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/caret-collapse/index.tsx",
"content": "\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/Geist\";\nimport { loadFont as loadMono } from \"@remotion/google-fonts/GeistMono\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport {\n linearTiming,\n type TransitionPresentation,\n type TransitionPresentationComponentProps,\n TransitionSeries,\n} from \"@remotion/transitions\";\nimport type React from \"react\";\nimport {\n AbsoluteFill,\n Easing,\n interpolate,\n spring,\n useCurrentFrame,\n useVideoConfig,\n} from \"remotion\";\nimport type { GradientParams } from \"@/lib/remocn/gsh/gradient-engine\";\nimport { GshGround } from \"@/lib/remocn/gsh/gsh-ground\";\nimport type { GshPresetId } from \"@/lib/remocn/gsh/presets\";\n\nconst sans = loadFont(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst mono = loadMono(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n weights: [\"600\"],\n subsets: [\"latin\"],\n});\n\nconst REMOCN_R_PATH =\n \"M 0.01 0.81 C 0.01 1.73, 0.36 2.79, 1.09 4.13 C 4.91 11.04, 13.45 17.16, 21.7 18.9 C 22.94 19.16, 23.18 19.16, 51.39 19.27 C 76.07 19.36, 80.02 19.4, 81.32 19.57 C 89.89 20.69, 96.2 24.68, 99.38 31.01 C 103.19 38.56, 102.53 50.1, 97.91 57.07 C 94.66 61.96, 89.68 64.99, 83.26 66 C 82.81 66.07, 70.18 66.83, 55.2 67.69 C 24.82 69.43, 27.03 69.23, 24.18 70.4 C 19.9 72.15, 14.84 75.7, 10.65 79.89 C 4.86 85.68, 1.3 91.91, 0.25 98.13 C 0.12 98.85, 0.08 103.13, 0.04 116.66 L 0 134.26 9.5 134.26 L 19 134.26 19.05 119.41 C 19.1 103.27, 19.08 103.82, 19.82 101.04 C 21.79 93.65, 27.86 88.75, 36.45 87.63 C 37.23 87.53, 39.41 87.5, 43.57 87.53 C 50.12 87.59, 50.75 87.65, 53.22 88.45 C 56.61 89.56, 59.67 91.86, 62.02 95.07 C 62.52 95.76, 69.35 103.85, 77.2 113.07 C 85.04 122.28, 91.63 130.04, 91.85 130.32 C 92.07 130.59, 92.5 131.34, 92.82 131.97 C 93.52 133.35, 94.11 133.93, 95.06 134.13 C 95.5 134.23, 98.97 134.26, 106.36 134.23 L 117.01 134.19 100.82 113.07 C 91.91 101.45, 84.52 91.78, 84.39 91.57 C 83.36 89.89, 83.66 87.53, 85.09 86 C 85.79 85.25, 86.36 84.94, 88.07 84.38 C 96.18 81.72, 104.15 76.62, 109.97 70.36 C 120.59 58.93, 124.06 44.32, 119.44 30.43 C 114.59 15.81, 101.93 4.02, 87.64 0.83 C 83.93 0.01, 88.09 0.08, 41.85 0.04 L 0.01 0 0.01 0.81 Z\";\n\nfunction RemocnLogo({ fontSize, color }: { fontSize: number; color: string }) {\n return (\n <div\n style={{\n display: \"flex\",\n alignItems: \"baseline\",\n color,\n fontFamily: manrope.fontFamily,\n fontWeight: 600,\n fontSize,\n letterSpacing: \"-0.025em\",\n lineHeight: 1,\n }}\n >\n <svg\n viewBox=\"0 0 124.06 134.26\"\n style={{ height: \"0.76em\", width: \"auto\" }}\n aria-hidden\n >\n <path fill=\"currentColor\" d={REMOCN_R_PATH} />\n </svg>\n <span style={{ marginLeft: \"0.04em\" }}>emocn</span>\n </div>\n );\n}\n\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\nexport type CaretPoint = { x: number; y: number; h: number };\n\nexport type CaretCollapseProps = {\n from?: CaretPoint;\n to?: CaretPoint;\n paper?: string;\n caret?: string;\n caretWidth?: number;\n};\n\nexport const caretCollapseDefaults: Required<CaretCollapseProps> = {\n from: { x: 0.5, y: 0.5, h: 0.1 },\n to: { x: 0.5, y: 0.5, h: 0.05 },\n paper: \"#f3f2ee\",\n caret: \"#3B5BFD\",\n caretWidth: 4,\n};\n\nconst PHASE = {\n cropX: [0, 0.34],\n cropY: [0.06, 0.36],\n caretIn: [0.28, 0.34],\n blinkOff: [0.42, 0.5],\n glide: [0.5, 0.66],\n openY: [0.68, 0.9],\n openX: [0.72, 1],\n handoff: 0.88,\n} as const;\n\nconst MORPH = Easing.bezier(0.65, 0, 0.35, 1);\nconst GLIDE = Easing.bezier(0.83, 0, 0.17, 1);\nconst OPEN = Easing.bezier(0.32, 0.72, 0, 1);\n\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\nconst ramp = (p: number, range: readonly [number, number], easing = MORPH) =>\n interpolate(p, [range[0], range[1]], [0, 1], { ...CLAMP, easing });\n\nfunction windowClip(\n W: number,\n H: number,\n cx: number,\n cy: number,\n cw: number,\n ch: number,\n tx: number,\n ty: number,\n) {\n const left = lerp(0, cx - cw / 2, tx);\n const right = lerp(W, cx + cw / 2, tx);\n const top = lerp(0, cy - ch / 2, ty);\n const bottom = lerp(H, cy + ch / 2, ty);\n const r = Math.min(22, (right - left) / 2, (bottom - top) / 2);\n return `inset(${top}px ${W - right}px ${H - bottom}px ${left}px round ${r}px)`;\n}\n\nfunction caretAt(p: number, o: Required<CaretCollapseProps>) {\n const g = ramp(p, PHASE.glide, GLIDE);\n return {\n x: lerp(o.from.x, o.to.x, g),\n y: lerp(o.from.y, o.to.y, g),\n h: lerp(o.from.h, o.to.h, g),\n };\n}\n\nconst CaretCollapsePresentation: React.FC<\n TransitionPresentationComponentProps<CaretCollapseProps>\n> = ({\n children,\n presentationProgress,\n presentationDirection,\n presentationDurationInFrames,\n passedProps,\n}) => {\n const { width: W, height: H } = useVideoConfig();\n const o = {\n ...caretCollapseDefaults,\n ...passedProps,\n } as Required<CaretCollapseProps>;\n const p = presentationProgress;\n\n if (presentationDirection === \"exiting\") {\n const tx = ramp(p, PHASE.cropX);\n const ty = ramp(p, PHASE.cropY);\n const cx = o.from.x * W;\n const cy = o.from.y * H;\n return (\n <AbsoluteFill style={{ backgroundColor: o.paper }}>\n <AbsoluteFill\n style={{\n clipPath: windowClip(\n W,\n H,\n cx,\n cy,\n o.caretWidth,\n o.from.h * H,\n tx,\n ty,\n ),\n opacity: p >= PHASE.cropY[1] ? 0 : 1,\n }}\n >\n <AbsoluteFill\n style={{\n transformOrigin: `${cx}px ${cy}px`,\n transform: `scale(${1 - 0.06 * tx})`,\n filter: `blur(${5 * tx}px)`,\n }}\n >\n {children}\n </AbsoluteFill>\n </AbsoluteFill>\n </AbsoluteFill>\n );\n }\n\n const tx = ramp(p, PHASE.openX, OPEN);\n const ty = ramp(p, PHASE.openY, OPEN);\n const ox = o.to.x * W;\n const oy = o.to.y * H;\n const step = 1 / Math.max(2, presentationDurationInFrames);\n const c = caretAt(p, o);\n const blinkOff = p > PHASE.blinkOff[0] && p < PHASE.blinkOff[1];\n const caretOpacity =\n interpolate(p, [PHASE.caretIn[0], PHASE.caretIn[1]], [0, 1], CLAMP) *\n (blinkOff ? 0 : 1) *\n (p >= PHASE.handoff ? 0 : 1);\n const prev = caretAt(Math.max(0, p - step * 1.5), o);\n\n return (\n <AbsoluteFill>\n <AbsoluteFill\n style={{\n clipPath: windowClip(\n W,\n H,\n ox,\n oy,\n o.caretWidth,\n o.to.h * H,\n 1 - tx,\n 1 - ty,\n ),\n opacity: p < PHASE.openY[0] ? 0 : 1,\n }}\n >\n <AbsoluteFill\n style={{\n transformOrigin: `${ox}px ${oy}px`,\n transform: `scale(${1 + 0.05 * (1 - tx)})`,\n filter: `blur(${4 * (1 - tx)}px)`,\n }}\n >\n {children}\n </AbsoluteFill>\n </AbsoluteFill>\n <div\n style={{\n position: \"absolute\",\n left: Math.min(prev.x, c.x) * W,\n top: (c.y - c.h * 0.32) * H,\n width: Math.abs(prev.x - c.x) * W,\n height: c.h * 0.64 * H,\n borderRadius: c.h * H,\n backgroundImage: `linear-gradient(${prev.x > c.x ? 90 : 270}deg, ${o.caret} 0%, transparent 100%)`,\n opacity: caretOpacity * 0.45,\n filter: \"blur(2px)\",\n }}\n />\n <div\n style={{\n position: \"absolute\",\n left: c.x * W - o.caretWidth / 2,\n top: (c.y - c.h / 2) * H,\n width: o.caretWidth,\n height: c.h * H,\n borderRadius: o.caretWidth,\n backgroundColor: o.caret,\n opacity: caretOpacity,\n }}\n />\n </AbsoluteFill>\n );\n};\n\nexport function caretCollapse(\n props: CaretCollapseProps = {},\n): TransitionPresentation<CaretCollapseProps> {\n return { component: CaretCollapsePresentation, props };\n}\n\nexport interface CaretCollapseDemoProps {\n theme?: \"dark\" | \"light\";\n accent?: string;\n url?: string;\n label?: string;\n question?: string;\n prompt?: string;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n groundB?: GshPresetId;\n groundParamsB?: Partial<GradientParams>;\n}\n\nconst THEMES = {\n dark: {\n ink: \"#eef1f8\",\n muted: \"rgba(226,232,246,0.56)\",\n faint: \"rgba(226,232,246,0.36)\",\n paper: \"#050609\",\n caret: \"#6f8cff\",\n card: \"rgba(16,18,26,0.82)\",\n chip: \"rgba(255,255,255,0.06)\",\n hairline: \"rgba(255,255,255,0.1)\",\n highlight: \"rgba(255,255,255,0.07)\",\n shadow: \"0,0,0\",\n sendInk: \"#ffffff\",\n groundA: {\n kind: \"limb\",\n colors: [\"#e8f4ff\", \"#4aa3ff\", \"#1d4fd6\", \"#06143a\"],\n background: \"#02040a\",\n speed: 1.2,\n loopSeconds: 10,\n seed: 3,\n } as Partial<GradientParams>,\n groundB: {\n kind: \"mist\",\n colors: [\"#c9d6ff\", \"#5b78ff\", \"#1f2b8f\", \"#070b24\"],\n background: \"#03050d\",\n speed: 0.7,\n loopSeconds: 16,\n scale: 0.85,\n warp: 0.4,\n blur: 0.7,\n seed: 12,\n } as Partial<GradientParams>,\n },\n light: {\n ink: \"#15171c\",\n muted: \"rgba(21,23,28,0.56)\",\n faint: \"rgba(21,23,28,0.36)\",\n paper: \"#f3f2ee\",\n caret: \"#3B5BFD\",\n card: \"rgba(255,255,255,0.86)\",\n chip: \"rgba(21,23,28,0.04)\",\n hairline: \"rgba(21,23,28,0.09)\",\n highlight: \"rgba(255,255,255,0.9)\",\n shadow: \"40,44,70\",\n sendInk: \"#ffffff\",\n groundA: {\n kind: \"mist\",\n colors: [\"#6e8dff\", \"#a9b9ff\", \"#d9defa\", \"#1a1f4a\"],\n background: \"#eeece8\",\n speed: 0.8,\n loopSeconds: 14,\n scale: 0.8,\n warp: 0.4,\n blur: 0.65,\n grain: 0.3,\n seed: 4,\n } as Partial<GradientParams>,\n groundB: {\n kind: \"mist\",\n colors: [\"#aebcff\", \"#d9dffb\", \"#c8b8ff\", \"#eef0f6\"],\n background: \"#f1f1f5\",\n speed: 0.6,\n loopSeconds: 16,\n scale: 0.85,\n warp: 0.4,\n blur: 0.75,\n grain: 0.22,\n seed: 14,\n } as Partial<GradientParams>,\n },\n};\n\nconst A_LEN = 72;\nconst B_LEN = 96;\nconst T_LEN = 36;\nexport const CARET_COLLAPSE_DURATION = A_LEN + B_LEN - T_LEN;\n\nconst A_BEATS = { label: 0, type: 4, typeEnd: 22 } as const;\nconst B_BEATS = { heading: 24, type: 40, typeEnd: 72, send: 78 } as const;\n\nconst MONO_ADVANCE = 0.6;\nconst TYPE_IN = Easing.bezier(0.32, 0.72, 0, 1);\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\n\nfunction urlLayout(W: number, H: number, url: string) {\n const tall = H > W;\n const fs = Math.min(\n tall ? W * 0.075 : W * 0.06,\n (W * 0.84) / (url.length * MONO_ADVANCE),\n );\n const textW = url.length * MONO_ADVANCE * fs;\n const left = (W - textW) / 2;\n const cy = H * 0.5;\n const caretW = Math.max(3, fs * 0.06);\n return {\n fs,\n left,\n cy,\n caretW,\n caretH: fs * 0.92,\n caretX: left + textW + fs * 0.08 + caretW / 2,\n };\n}\n\nfunction promptLayout(W: number, H: number) {\n const tall = H > W;\n const s = tall ? W / 900 : (W / 1280) * 1.1;\n const cardW = tall ? W * 0.86 : W * 0.62;\n const cardLeft = (W - cardW) / 2;\n const cardTop = tall ? H * 0.44 : H * 0.42;\n const pad = 22 * s;\n const chipH = 40 * s;\n const fs = (tall ? 34 : 25) * s;\n const lineTop = cardTop + pad + chipH + 16 * s;\n const caretW = Math.max(2.5, 2.6 * s);\n return {\n s,\n tall,\n cardW,\n cardLeft,\n cardTop,\n pad,\n chipH,\n fs,\n lineTop,\n caretW,\n caretH: fs * 1.08,\n caretX: cardLeft + pad + caretW / 2,\n caretY: lineTop + fs * 0.69,\n };\n}\n\nfunction SceneA({\n url,\n label,\n palette,\n ground,\n groundParams,\n}: {\n url: string;\n label: string;\n palette: (typeof THEMES)[\"dark\"];\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}) {\n const frame = useCurrentFrame();\n const { width: W, height: H } = useVideoConfig();\n const L = urlLayout(W, H, url);\n const typed = Math.floor(\n interpolate(frame, [A_BEATS.type, A_BEATS.typeEnd], [0, url.length], CLAMP),\n );\n const lab = interpolate(frame, [A_BEATS.label, A_BEATS.label + 12], [0, 1], {\n ...CLAMP,\n easing: TYPE_IN,\n });\n const push = interpolate(frame, [0, A_LEN], [1, 1.03], CLAMP);\n const slash = url.indexOf(\"/\");\n return (\n <AbsoluteFill>\n <GshGround\n preset={ground}\n params={ground ? groundParams : { ...palette.groundA, ...groundParams }}\n timeOffset={2}\n timeScale={0.6}\n />\n <AbsoluteFill\n style={{\n transform: `scale(${push})`,\n transformOrigin: `${L.caretX}px ${L.cy}px`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: L.cy - L.fs * 1.55,\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: L.fs * 0.22,\n opacity: lab,\n transform: `translateY(${(1 - lab) * 12}px)`,\n fontFamily: sans.fontFamily,\n fontWeight: 400,\n fontSize: Math.max(H * 0.028, L.fs * 0.3),\n color: palette.muted,\n }}\n >\n <RemocnLogo\n fontSize={Math.max(H * 0.03, L.fs * 0.32)}\n color={palette.ink}\n />\n <span>{label}</span>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: L.left,\n top: L.cy - L.fs * 0.6,\n height: L.fs * 1.2,\n lineHeight: `${L.fs * 1.2}px`,\n fontFamily: mono.fontFamily,\n fontWeight: 300,\n fontSize: L.fs,\n letterSpacing: 0,\n whiteSpace: \"pre\",\n color: palette.ink,\n }}\n >\n {url.split(\"\").map((ch, i) => (\n <span\n key={`${ch}-${i}`}\n style={{\n color:\n i >= typed\n ? \"transparent\"\n : slash >= 0 && i >= slash\n ? palette.caret\n : palette.ink,\n }}\n >\n {ch}\n </span>\n ))}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: L.left + typed * MONO_ADVANCE * L.fs + L.fs * 0.08,\n top: L.cy - L.caretH / 2,\n width: L.caretW,\n height: L.caretH,\n borderRadius: L.caretW,\n backgroundColor: palette.caret,\n }}\n />\n </AbsoluteFill>\n </AbsoluteFill>\n );\n}\n\nfunction Icon({ d, size, color }: { d: string; size: number; color: string }) {\n return (\n <svg viewBox=\"0 0 24 24\" width={size} height={size} aria-hidden>\n <path\n d={d}\n fill=\"none\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nconst ICONS = {\n plus: \"M12 5v14M5 12h14\",\n link: \"M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1\",\n close: \"M7 7l10 10M17 7L7 17\",\n chevron: \"M7 10l5 5 5-5\",\n mic: \"M12 4a3 3 0 0 0-3 3v5a3 3 0 0 0 6 0V7a3 3 0 0 0-3-3zM6 11a6 6 0 0 0 12 0M12 17v3\",\n up: \"M12 19V5M6 11l6-6 6 6\",\n spark:\n \"M12 4v4M12 16v4M4 12h4M16 12h4M6.5 6.5l2.5 2.5M15 15l2.5 2.5M17.5 6.5L15 9M9 15l-2.5 2.5\",\n};\n\nfunction SceneB({\n question,\n prompt,\n url,\n palette,\n ground,\n groundParams,\n}: {\n question: string;\n prompt: string;\n url: string;\n palette: (typeof THEMES)[\"dark\"];\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}) {\n const frame = useCurrentFrame();\n const { width: W, height: H, fps } = useVideoConfig();\n const P = promptLayout(W, H);\n const s = P.s;\n const typed = Math.floor(\n interpolate(\n frame,\n [B_BEATS.type, B_BEATS.typeEnd],\n [0, prompt.length],\n CLAMP,\n ),\n );\n const done = typed >= prompt.length;\n const caretOn = !done || Math.floor((frame - B_BEATS.typeEnd) / 8) % 2 === 1;\n const send = spring({ frame: frame - B_BEATS.send, fps, config: CHIP });\n const armed = interpolate(\n frame,\n [B_BEATS.typeEnd - 6, B_BEATS.typeEnd],\n [0, 1],\n CLAMP,\n );\n const push = interpolate(frame, [0, B_LEN], [1, 1.03], CLAMP);\n const words = question.split(\" \");\n const qfs = (P.tall ? 60 : 54) * s;\n const pill = (label: string, icon?: string) => (\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 6 * s,\n height: 36 * s,\n padding: `0 ${12 * s}px`,\n borderRadius: 999,\n color: palette.muted,\n fontSize: 16 * s,\n }}\n >\n {icon ? <Icon d={icon} size={16 * s} color={palette.muted} /> : null}\n {label}\n <Icon d={ICONS.chevron} size={14 * s} color={palette.faint} />\n </div>\n );\n return (\n <AbsoluteFill>\n <GshGround\n preset={ground}\n params={ground ? groundParams : { ...palette.groundB, ...groundParams }}\n timeOffset={5}\n timeScale={0.6}\n />\n <AbsoluteFill\n style={{\n transform: `scale(${push})`,\n transformOrigin: `${P.caretX}px ${P.caretY}px`,\n fontFamily: sans.fontFamily,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: P.cardLeft - 40 * s,\n width: P.cardW + 80 * s,\n top: P.cardTop - qfs * (P.tall ? 2.9 : 1.75),\n display: \"flex\",\n flexWrap: \"wrap\",\n justifyContent: \"center\",\n columnGap: \"0.24em\",\n fontSize: qfs,\n fontWeight: 300,\n letterSpacing: \"-0.035em\",\n lineHeight: 1.08,\n color: palette.ink,\n }}\n >\n {words.map((w, i) => {\n const p = interpolate(\n frame,\n [B_BEATS.heading + i * 2, B_BEATS.heading + i * 2 + 13],\n [0, 1],\n { ...CLAMP, easing: TYPE_IN },\n );\n return (\n <span\n key={`${w}-${i}`}\n style={{\n display: \"inline-block\",\n overflow: \"hidden\",\n padding: \"0.04em 0.04em 0.14em\",\n margin: \"-0.04em -0.04em -0.14em\",\n }}\n >\n <span\n style={{\n display: \"inline-block\",\n transform: `translateY(${(1 - p) * 130}%)`,\n }}\n >\n {w}\n </span>\n </span>\n );\n })}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: P.cardLeft,\n top: P.cardTop,\n width: P.cardW,\n padding: P.pad,\n borderRadius: 24 * s,\n backgroundColor: palette.card,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}, inset 0 1px 0 ${palette.highlight}, 0 1px 2px rgba(${palette.shadow},0.12), 0 12px 32px rgba(${palette.shadow},0.18), 0 40px 90px rgba(${palette.shadow},0.22)`,\n backdropFilter: \"blur(18px)\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: 16 * s,\n }}\n >\n <div\n style={{\n alignSelf: \"flex-start\",\n display: \"flex\",\n alignItems: \"center\",\n gap: 8 * s,\n height: P.chipH,\n padding: `0 ${10 * s}px 0 ${6 * s}px`,\n borderRadius: 12 * s,\n backgroundColor: palette.chip,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}`,\n fontSize: 15 * s,\n color: palette.ink,\n }}\n >\n <div\n style={{\n width: 28 * s,\n height: 28 * s,\n borderRadius: 8 * s,\n backgroundColor: palette.caret,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <Icon d={ICONS.link} size={16 * s} color=\"#ffffff\" />\n </div>\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n lineHeight: 1.15,\n }}\n >\n <span>{url}</span>\n <span style={{ color: palette.faint, fontSize: 12.5 * s }}>\n Brand kit attached\n </span>\n </div>\n <Icon d={ICONS.close} size={14 * s} color={palette.faint} />\n </div>\n <div\n style={{\n minHeight: P.fs * 1.38 * (P.tall ? 3 : 2),\n fontSize: P.fs,\n lineHeight: 1.38,\n fontWeight: 400,\n letterSpacing: \"-0.01em\",\n color: palette.ink,\n }}\n >\n {prompt.slice(0, typed)}\n <span\n style={{\n display: \"inline-block\",\n width: P.caretW,\n height: P.caretH,\n marginLeft: typed > 0 ? 2 * s : 0,\n verticalAlign: \"-0.2em\",\n borderRadius: P.caretW,\n backgroundColor: palette.caret,\n opacity: caretOn ? 1 : 0,\n }}\n />\n </div>\n <div style={{ display: \"flex\", alignItems: \"center\", gap: 6 * s }}>\n <div\n style={{\n width: 36 * s,\n height: 36 * s,\n borderRadius: 999,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}`,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <Icon d={ICONS.plus} size={18 * s} color={palette.muted} />\n </div>\n {pill(\"Launch film\", ICONS.spark)}\n <div style={{ flex: 1 }} />\n {pill(\"Build\")}\n <Icon d={ICONS.mic} size={20 * s} color={palette.muted} />\n <div\n style={{\n width: 38 * s,\n height: 38 * s,\n marginLeft: 6 * s,\n borderRadius: 11 * s,\n backgroundColor: palette.caret,\n opacity: 0.35 + armed * 0.65,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n transform: `scale(${1 - Math.sin(Math.min(1, send) * Math.PI) * 0.12})`,\n boxShadow: `0 6px 18px rgba(${palette.shadow},${0.25 * armed})`,\n }}\n >\n <Icon d={ICONS.up} size={20 * s} color={palette.sendInk} />\n </div>\n </div>\n </div>\n </AbsoluteFill>\n </AbsoluteFill>\n );\n}\n\nexport function CaretCollapseDemo({\n theme = \"dark\",\n accent,\n url = \"remocn.dev/launch\",\n label = \"is live\",\n question = \"What will you launch next?\",\n prompt = \"Make a 30-second launch film for our 2.0 release\",\n ground,\n groundParams,\n groundB,\n groundParamsB,\n}: CaretCollapseDemoProps) {\n const base = THEMES[theme];\n const palette = { ...base, caret: accent ?? base.caret };\n const { width: W, height: H } = useVideoConfig();\n const A = urlLayout(W, H, url);\n const B = promptLayout(W, H);\n return (\n <AbsoluteFill style={{ backgroundColor: palette.paper }}>\n <TransitionSeries>\n <TransitionSeries.Sequence durationInFrames={A_LEN}>\n <SceneA\n url={url}\n label={label}\n palette={palette}\n ground={ground}\n groundParams={groundParams}\n />\n </TransitionSeries.Sequence>\n <TransitionSeries.Transition\n presentation={caretCollapse({\n from: {\n x: A.caretX / W,\n y: A.cy / H,\n h: A.caretH / H,\n },\n to: { x: B.caretX / W, y: B.caretY / H, h: B.caretH / H },\n paper: palette.paper,\n caret: palette.caret,\n caretWidth: A.caretW,\n })}\n timing={linearTiming({ durationInFrames: T_LEN })}\n />\n <TransitionSeries.Sequence durationInFrames={B_LEN}>\n <SceneB\n question={question}\n prompt={prompt}\n url={url}\n palette={palette}\n ground={groundB}\n groundParams={groundParamsB}\n />\n </TransitionSeries.Sequence>\n </TransitionSeries>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/caret-collapse.tsx"
}
],
"type": "registry:component"
}