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": "launch-days",
"title": "Launch Days",
"description": "Vertical day tabs expand one into a big card, '03 Templates', under a Launch Week header.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/launch-days/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadHanken } from \"@remotion/google-fonts/HankenGrotesk\";\nimport { loadFont as loadMono } from \"@remotion/google-fonts/JetBrainsMono\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport type React from \"react\";\nimport { Fragment } 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 hanken = loadHanken(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst mono = loadMono(\"normal\", { weights: [\"400\"], subsets: [\"latin\"] });\nconst manrope = loadManrope(\"normal\", {\n weights: [\"600\"],\n subsets: [\"latin\"],\n});\n\nexport interface LaunchDay {\n day: string;\n title: string;\n description?: string;\n}\n\nexport interface LaunchDaysProps {\n week?: string;\n label?: string;\n days?: LaunchDay[];\n active?: number;\n from?: number;\n revealUpcoming?: boolean;\n logo?: React.ReactNode;\n accent?: string;\n background?: string;\n speed?: number;\n theme?: \"dark\" | \"light\";\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst DEFAULT_DAYS: LaunchDay[] = [\n {\n day: \"Mon\",\n title: \"Captions\",\n description: \"31 transcript-driven caption styles.\",\n },\n {\n day: \"Tue\",\n title: \"Transitions\",\n description: \"Cuts that land on the beat.\",\n },\n {\n day: \"Wed\",\n title: \"Templates\",\n description:\n \"Whole launch films, installed into your project and yours to edit.\",\n },\n {\n day: \"Thu\",\n title: \"Agent skill\",\n description: \"Your agent reads the docs and picks the beat.\",\n },\n {\n day: \"Fri\",\n title: \"Studio\",\n description: \"Preview every scene before it renders.\",\n },\n];\n\nconst PALETTES = {\n dark: {\n bg: \"#0A0A0B\",\n scrim: \"rgba(10,10,11,0.84)\",\n fg: \"#F4F3F0\",\n muted: \"#8E8D94\",\n faint: \"#55555C\",\n panel: \"rgba(255,255,255,0.03)\",\n line: \"rgba(255,255,255,0.08)\",\n litLine: \"rgba(255,255,255,0.14)\",\n activeFg: \"#F7F8FF\",\n activeMuted: \"rgba(236,240,255,0.74)\",\n shade:\n \"linear-gradient(180deg, rgba(4,6,20,0) 35%, rgba(4,6,20,0.55) 100%)\",\n ground: \"film-blue\" as GshPresetId,\n groundParams: undefined as Partial<GradientParams> | undefined,\n },\n light: {\n bg: \"#F5F4F0\",\n scrim: \"rgba(245,244,240,0.84)\",\n fg: \"#111113\",\n muted: \"#6E6C67\",\n faint: \"#A9A69E\",\n panel: \"rgba(255,255,255,0.5)\",\n line: \"rgba(17,17,19,0.08)\",\n litLine: \"rgba(17,17,19,0.1)\",\n activeFg: \"#0B0D1E\",\n activeMuted: \"rgba(11,13,30,0.68)\",\n shade:\n \"linear-gradient(180deg, rgba(245,246,252,0) 35%, rgba(245,246,252,0.6) 100%)\",\n ground: \"glasswork\" as GshPresetId,\n groundParams: {\n colors: [\"#a9bcff\", \"#3552ff\", \"#1a2a9e\", \"#7f9bff\"],\n } as Partial<GradientParams> | undefined,\n },\n} as const;\n\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_IN = Easing.bezier(0.55, 0, 1, 0.45);\nconst SPRING_CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst SPRING_MORPH = { damping: 200 };\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\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\nfunction estimateEm(text: string) {\n let w = 0;\n for (const ch of text) {\n if (ch === \" \") w += 0.24;\n else if (/[ilIj.,'’!|]/.test(ch)) w += 0.25;\n else if (/[mwMW]/.test(ch)) w += 0.82;\n else if (/[A-Z]/.test(ch)) w += 0.64;\n else if (/[0-9]/.test(ch)) w += 0.55;\n else w += 0.52;\n }\n return w;\n}\n\nconst pad2 = (n: number) => String(n).padStart(2, \"0\");\n\nexport function LaunchDays({\n week = \"Launch Week 01\",\n label = \"New today\",\n days = DEFAULT_DAYS,\n active = 2,\n from,\n revealUpcoming = false,\n logo,\n accent = \"#3B5BFD\",\n background,\n speed = 1,\n theme = \"dark\",\n ground,\n groundParams,\n}: LaunchDaysProps) {\n const raw = useCurrentFrame();\n const frame = raw * speed;\n const { width, height, fps } = useVideoConfig();\n const p = PALETTES[theme];\n\n const list = days.length >= 2 ? days.slice(0, 7) : DEFAULT_DAYS;\n const n = list.length;\n const act = Math.min(Math.max(0, Math.round(active)), n - 1);\n const swap =\n from !== undefined && Math.round(from) !== act\n ? Math.min(Math.max(0, Math.round(from)), n - 1)\n : null;\n\n const portrait = height > width * 1.1;\n const u = Math.min(width, height) / 720;\n const margin = 40 * u;\n const marginX = portrait ? width * 0.07 : width * 0.1;\n const headerH = week || logo !== null ? 64 * u : 0;\n const gap = 8 * u;\n const radius = 16 * u;\n\n const stripW = width - marginX * 2;\n const stripH = height - margin - headerH - margin * (headerH ? 0 : 1);\n const main = portrait ? stripH : stripW;\n const cross = portrait ? stripW : stripH;\n const sliver = Math.max(\n 44 * u,\n Math.min((portrait ? 92 : 76) * u, main * 0.075),\n );\n const free = main - gap * (n - 1);\n const equal = free / n;\n const wide = free - sliver * (n - 1);\n\n const rise = (i: number) =>\n swap === null\n ? spring({ frame: frame - i * 2, fps, config: SPRING_CARD })\n : 1;\n const open = spring({\n frame: frame - 14,\n fps,\n config: SPRING_MORPH,\n durationInFrames: 28,\n });\n const sizeOf = (i: number) => {\n if (swap === null) {\n return interpolate(open, [0, 1], [equal, i === act ? wide : sliver]);\n }\n const a = i === swap ? wide : sliver;\n const b = i === act ? wide : sliver;\n return interpolate(open, [0, 1], [a, b]);\n };\n\n const eyebrowT = interpolate(frame, [26, 42], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n const wordT = (i: number) =>\n interpolate(frame, [30 + i * 3, 48 + i * 3], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n const outT = (i: number) =>\n interpolate(frame, [6 + i * 2, 16 + i * 2], [0, 1], {\n ...CLAMP,\n easing: EASE_IN,\n });\n\n const panelPad = (portrait ? 44 : 36) * u;\n const avail = (portrait ? cross : wide) - panelPad * 2;\n const base = (portrait ? 150 : 136) * u;\n const numFs = (portrait ? 150 : 112) * u;\n const titleFs = (title: string) => {\n const em = estimateEm(title);\n const one = avail / Math.max(em, 0.5);\n if (one >= base * 0.78) return Math.min(base, one);\n return Math.max(base * 0.5, Math.min(base * 0.86, (avail * 1.9) / em));\n };\n\n const transparent = background === \"transparent\";\n const showHeader = headerH > 0;\n const labelFs = 16 * u;\n const preset = ground ?? (groundParams ? undefined : p.ground);\n const litO = (i: number) =>\n i === act\n ? interpolate(frame, [16, 40], [0, 1], { ...CLAMP, easing: EASE_OUT })\n : i === swap\n ? 1 -\n interpolate(frame, [14, 36], [0, 1], { ...CLAMP, easing: EASE_IN })\n : 0;\n const stripX = marginX;\n const stripY = showHeader ? headerH + margin * 0.15 : margin;\n const sizes = list.map((_, i) => sizeOf(i));\n const rectOf = (i: number) => {\n let at = 0;\n for (let k = 0; k < i; k++) at += (sizes[k] as number) + gap;\n const lift = (1 - rise(i)) * 30 * u;\n const sz = sizes[i] as number;\n return portrait\n ? { x: stripX, y: stripY + at + lift, w: stripW, h: sz }\n : { x: stripX + at, y: stripY + lift, w: sz, h: stripH - margin * 0.15 };\n };\n const rr = (x: number, y: number, w: number, h: number, r: number) =>\n `M${x + r} ${y}H${x + w - r}A${r} ${r} 0 0 1 ${x + w} ${y + r}V${y + h - r}A${r} ${r} 0 0 1 ${x + w - r} ${y + h}H${x + r}A${r} ${r} 0 0 1 ${x} ${y + h - r}V${y + r}A${r} ${r} 0 0 1 ${x + r} ${y}Z`;\n const holes = list\n .map((_, i) => i)\n .filter((i) => litO(i) > 0.001)\n .map((i) => {\n const q = rectOf(i);\n return rr(q.x, q.y, q.w, q.h, radius);\n });\n const scrimD = `M0 0H${width}V${height}H0Z${holes.join(\"\")}`;\n\n const headerT = interpolate(frame, [0, 18], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n\n const renderOpen = (\n d: LaunchDay,\n i: number,\n mode: \"in\" | \"out\",\n size: number,\n ) => {\n const fs = titleFs(d.title);\n const words = d.title.split(/\\s+/).filter(Boolean);\n const shown = mode === \"in\";\n const eb = shown ? eyebrowT : 1 - outT(0);\n const numT = shown\n ? interpolate(frame, [24, 44], [0, 1], { ...CLAMP, easing: EASE_OUT })\n : 1 - outT(0);\n const descT = shown\n ? interpolate(\n frame,\n [40 + words.length * 3, 60 + words.length * 3],\n [0, 1],\n {\n ...CLAMP,\n easing: EASE_OUT,\n },\n )\n : 1 - outT(1);\n const box = portrait ? cross : wide;\n const contentOpacity = interpolate(\n size,\n [sliver * 1.2, sliver * 2.4],\n [0, 1],\n CLAMP,\n );\n return (\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n width: portrait ? box : wide,\n height: portrait ? wide : cross,\n padding: panelPad,\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"space-between\",\n opacity: contentOpacity,\n }}\n >\n <div\n style={{\n display: \"flex\",\n alignItems: \"flex-start\",\n justifyContent: \"space-between\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 12 * u,\n marginTop: 6 * u,\n fontFamily: mono.fontFamily,\n fontWeight: 400,\n fontSize: labelFs * 1.1,\n letterSpacing: \"0.08em\",\n textTransform: \"uppercase\",\n color: p.activeFg,\n opacity: eb,\n transform: `translateX(${(1 - eb) * -16 * u}px)`,\n }}\n >\n <span>{d.day}</span>\n {label ? (\n <>\n <span\n style={{\n width: 22 * u,\n height: 1,\n background: p.activeMuted,\n opacity: 0.6,\n }}\n />\n <span style={{ color: p.activeMuted }}>{label}</span>\n </>\n ) : null}\n </div>\n <span\n style={{\n display: \"inline-block\",\n overflow: \"hidden\",\n paddingRight: \"0.04em\",\n marginTop: -numFs * 0.12,\n marginRight: -numFs * 0.02,\n }}\n >\n <span\n style={{\n display: \"inline-block\",\n fontFamily: hanken.fontFamily,\n fontWeight: 400,\n fontSize: numFs,\n lineHeight: 1,\n letterSpacing: \"-0.05em\",\n fontVariantNumeric: \"tabular-nums\",\n color: p.activeFg,\n transform: `translateY(${(1 - numT) * 100}%)`,\n }}\n >\n {pad2(i + 1)}\n </span>\n </span>\n </div>\n <div>\n <div\n style={{\n fontFamily: hanken.fontFamily,\n fontWeight: 400,\n fontSize: fs,\n lineHeight: 0.98,\n letterSpacing: \"-0.045em\",\n color: p.activeFg,\n textWrap: \"balance\",\n marginLeft: -fs * 0.04,\n }}\n >\n {words.map((w, k) => {\n const t = shown ? wordT(k) : 1;\n const o = shown ? 0 : outT(k);\n return (\n <Fragment key={`${w}-${k}`}>\n {k > 0 ? \" \" : null}\n <span\n style={{\n display: \"inline-block\",\n overflow: \"hidden\",\n verticalAlign: \"top\",\n paddingBottom: \"0.12em\",\n marginBottom: \"-0.12em\",\n paddingRight: \"0.05em\",\n marginRight: \"-0.05em\",\n }}\n >\n <span\n style={{\n display: \"inline-block\",\n transform: `translateY(${(1 - t) * 105 - o * 105}%)`,\n }}\n >\n {w}\n </span>\n </span>\n </Fragment>\n );\n })}\n </div>\n {d.description ? (\n <div\n style={{\n marginTop: fs * 0.26,\n maxWidth: Math.min(avail, 620 * u),\n fontFamily: hanken.fontFamily,\n fontWeight: 400,\n fontSize: (portrait ? 30 : 24) * u,\n lineHeight: 1.35,\n letterSpacing: \"-0.01em\",\n color: p.activeMuted,\n textWrap: \"balance\",\n opacity: descT,\n transform: `translateY(${(1 - descT) * 12 * u}px)`,\n filter: `blur(${(1 - descT) * 5 * u}px)`,\n }}\n >\n {d.description}\n </div>\n ) : null}\n </div>\n </div>\n );\n };\n\n return (\n <AbsoluteFill\n style={{\n background: transparent ? \"transparent\" : (background ?? p.bg),\n overflow: \"hidden\",\n }}\n >\n {transparent || background ? null : (\n <>\n <GshGround\n preset={preset}\n params={groundParams ?? (ground ? undefined : p.groundParams)}\n timeOffset={theme === \"light\" ? 4 : 2}\n timeScale={0.5}\n />\n <svg\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n style={{ position: \"absolute\", inset: 0 }}\n aria-hidden\n >\n <path d={scrimD} fill={p.scrim} fillRule=\"evenodd\" />\n </svg>\n </>\n )}\n {showHeader ? (\n <div\n style={{\n position: \"absolute\",\n left: marginX,\n right: marginX,\n top: 0,\n height: headerH + margin * 0.15,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n opacity: headerT,\n transform: `translateY(${(1 - headerT) * -8 * u}px)`,\n }}\n >\n <span\n style={{\n fontFamily: mono.fontFamily,\n fontWeight: 400,\n fontSize: labelFs * 1.1,\n letterSpacing: \"0.08em\",\n textTransform: \"uppercase\",\n color: p.fg,\n }}\n >\n {week}\n </span>\n {logo === null ? null : (\n <div style={{ display: \"flex\", alignItems: \"center\" }}>\n {logo ?? <RemocnLogo fontSize={24 * u} color={p.fg} />}\n </div>\n )}\n </div>\n ) : null}\n\n <div\n style={{\n position: \"absolute\",\n left: stripX,\n top: stripY,\n width: stripW,\n height: stripH - margin * 0.15,\n display: \"flex\",\n flexDirection: portrait ? \"column\" : \"row\",\n gap,\n }}\n >\n {list.map((d, i) => {\n const size = sizeOf(i);\n const r = rise(i);\n const isAct = i === act;\n const isFrom = i === swap;\n const groundO = litO(i);\n const past = i < act;\n const upcoming = i > act;\n const sliverTitle = upcoming && !revealUpcoming ? \"\" : d.title;\n const labelO = interpolate(\n size,\n [equal * 1.05, equal * 1.6],\n [1, 0],\n CLAMP,\n );\n const numColor = isAct ? p.activeFg : past ? p.fg : p.muted;\n return (\n <div\n key={`${d.day}-${i}`}\n style={{\n position: \"relative\",\n flex: \"none\",\n [portrait ? \"height\" : \"width\"]: size,\n [portrait ? \"width\" : \"height\"]: \"100%\",\n borderRadius: radius,\n overflow: \"hidden\",\n background: groundO > 0.001 ? undefined : p.panel,\n boxShadow: `inset 0 0 0 1px ${groundO > 0.5 ? p.litLine : p.line}`,\n clipPath: `inset(${Math.max(0, 1 - r) * 100}% 0 0 0 round ${radius}px)`,\n transform: `translateY(${(1 - r) * 30 * u}px)`,\n }}\n >\n {groundO > 0 ? (\n <>\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n background: p.scrim,\n opacity: 1 - groundO,\n }}\n />\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n background: p.shade,\n opacity: groundO,\n }}\n />\n </>\n ) : null}\n\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n padding: `${18 * u}px ${portrait ? 24 * u : 0}px`,\n display: \"flex\",\n flexDirection: portrait ? \"row\" : \"column\",\n alignItems: portrait ? \"center\" : \"center\",\n justifyContent: \"space-between\",\n opacity: labelO * interpolate(r, [0.4, 1], [0, 1], CLAMP),\n }}\n >\n <div\n style={{\n display: \"flex\",\n flexDirection: portrait ? \"row\" : \"column\",\n alignItems: \"center\",\n gap: 10 * u,\n }}\n >\n <span\n style={{\n fontFamily: mono.fontFamily,\n fontWeight: 400,\n fontSize: labelFs * 1.15,\n letterSpacing: \"0.04em\",\n color: numColor,\n }}\n >\n {pad2(i + 1)}\n </span>\n {past ? (\n <span\n style={{\n width: 6 * u,\n height: 6 * u,\n borderRadius: 99,\n background: accent,\n }}\n />\n ) : null}\n </div>\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 12 * u,\n writingMode: portrait ? undefined : \"vertical-rl\",\n transform: portrait ? undefined : \"rotate(180deg)\",\n whiteSpace: \"nowrap\",\n }}\n >\n <span\n style={{\n fontFamily: mono.fontFamily,\n fontWeight: 400,\n fontSize: labelFs,\n letterSpacing: \"0.1em\",\n textTransform: \"uppercase\",\n color: past ? p.muted : p.faint,\n }}\n >\n {d.day}\n </span>\n {sliverTitle ? (\n <span\n style={{\n fontFamily: hanken.fontFamily,\n fontWeight: 400,\n fontSize: labelFs * 1.6,\n letterSpacing: \"-0.02em\",\n color: past ? p.fg : p.muted,\n }}\n >\n {sliverTitle}\n </span>\n ) : null}\n </div>\n </div>\n\n {isAct ? renderOpen(d, i, \"in\", size) : null}\n {isFrom ? renderOpen(d, i, \"out\", size) : null}\n </div>\n );\n })}\n </div>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/launch-days.tsx"
}
],
"type": "registry:component"
}