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": "video-watch-page",
"title": "Video Watch Page",
"description": "A video watch page with a player, related list and comments.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/video-watch-page/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 type React from \"react\";\nimport {\n AbsoluteFill,\n Easing,\n Img,\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 { fontFamily } = loadFont(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst { fontFamily: mono } = loadMono(\"normal\", {\n weights: [\"400\"],\n subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n weights: [\"600\"],\n subsets: [\"latin\"],\n});\n\nexport interface WatchChannel {\n name: string;\n subscribers: number;\n color?: string;\n}\n\nexport interface WatchStats {\n likesFrom: number;\n likesTo: number;\n viewsFrom: number;\n viewsTo: number;\n commentsFrom: number;\n commentsTo: number;\n}\n\nexport interface VideoWatchPageProps {\n title?: string;\n channel?: Partial<WatchChannel>;\n stats?: Partial<WatchStats>;\n /** Poster/frame shown in the player. */\n src?: string;\n /** Custom player content (wins over `src`), laid out at 836×470. */\n children?: React.ReactNode;\n accent?: string;\n speed?: number;\n theme?: \"light\" | \"dark\";\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst HOVER_IN = 30;\nconst HOVER_OUT = 72;\nconst SUB_CLICK = 92;\nconst LIKE_CLICK = 120;\nconst END = 210;\n\nconst HEAVY = { mass: 1, damping: 26, stiffness: 120 };\nconst CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst RISE = Easing.bezier(0.22, 1, 0.36, 1);\nconst MOVE = Easing.bezier(0.65, 0, 0.35, 1);\nconst EXIT = Easing.bezier(0.55, 0, 1, 0.45);\nconst CAMERA = Easing.bezier(0.87, 0, 0.13, 1);\n\nconst CL = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\nconst clamp = (v: number, lo = 0, hi = 1) => Math.min(hi, Math.max(lo, v));\n\nfunction rgb(c: string): [number, number, number] {\n const hex = c.replace(\"#\", \"\");\n const full = hex.length === 3 ? hex.replace(/(.)/g, \"$1$1\") : hex;\n if (!/^[0-9a-fA-F]{6}$/.test(full)) return [128, 128, 128];\n const n = Number.parseInt(full, 16);\n return [(n >> 16) & 255, (n >> 8) & 255, n & 255];\n}\nfunction mix(a: string, b: string, t: number) {\n const x = rgb(a);\n const y = rgb(b);\n const m = (i: number) => Math.round(x[i] + (y[i] - x[i]) * t);\n return `rgb(${m(0)}, ${m(1)}, ${m(2)})`;\n}\nconst group = (n: number) =>\n String(Math.round(n)).replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\nfunction compact(n: number) {\n if (n >= 1e6) return `${(n / 1e6).toFixed(1).replace(/\\.0$/, \"\")}M`;\n if (n >= 1e5) return `${Math.round(n / 1e3)}K`;\n if (n >= 1e3) return `${(n / 1e3).toFixed(1).replace(/\\.0$/, \"\")}K`;\n return String(Math.round(n));\n}\nconst expLerp = (a: number, b: number, t: number) => a * (b / a) ** t;\n\ninterface Pal {\n win: string;\n surface: string;\n text: string;\n muted: string;\n faint: string;\n hair: string;\n strong: string;\n onStrong: string;\n shadow: string;\n scrim: string;\n}\nconst LIGHT: Pal = {\n win: \"#ffffff\",\n surface: \"#f4f4f5\",\n text: \"#18181b\",\n muted: \"#63636b\",\n faint: \"#9a9aa2\",\n hair: \"rgba(24,24,27,0.08)\",\n strong: \"#18181b\",\n onStrong: \"#ffffff\",\n shadow:\n \"0 0 0 1px rgba(24,24,27,0.06), 0 2px 4px rgba(24,24,27,0.04), 0 30px 70px -20px rgba(20,30,90,0.3)\",\n scrim: \"rgba(238,240,246,0.2)\",\n};\nconst DARK: Pal = {\n win: \"#111113\",\n surface: \"#1c1c1f\",\n text: \"#ededef\",\n muted: \"#9d9da6\",\n faint: \"#6a6a72\",\n hair: \"rgba(255,255,255,0.07)\",\n strong: \"#ededef\",\n onStrong: \"#111113\",\n shadow: \"0 0 0 1px rgba(255,255,255,0.09), 0 40px 90px -20px rgba(0,0,0,0.7)\",\n scrim: \"rgba(2,4,10,0.25)\",\n};\n\nconst ICON: Record<string, string> = {\n like: \"M7.5 10.5v9h-3v-9zM7.5 10.5 11 4c1.6 0 2.5 1.1 2.2 2.6L12.6 9.5h5.2a2 2 0 0 1 2 2.4l-1.3 6a2 2 0 0 1-2 1.6H7.5\",\n share:\n \"M12 15V3.5M7.5 8 12 3.5 16.5 8M5 13v5.5A1.5 1.5 0 0 0 6.5 20h11a1.5 1.5 0 0 0 1.5-1.5V13\",\n pause: \"M8.5 6v12M15.5 6v12\",\n vol: \"M4.5 9.5h3l4-3.5v12l-4-3.5h-3zM15 9a4 4 0 0 1 0 6M17.5 6.5a7.5 7.5 0 0 1 0 11\",\n cc: \"M5 5.5h14a1.5 1.5 0 0 1 1.5 1.5v10a1.5 1.5 0 0 1-1.5 1.5H5A1.5 1.5 0 0 1 3.5 17V7A1.5 1.5 0 0 1 5 5.5zM10.4 10.3a2.2 2.2 0 1 0 0 3.4M16.4 10.3a2.2 2.2 0 1 0 0 3.4\",\n full: \"M4.5 9V4.5H9M15 4.5h4.5V9M19.5 15v4.5H15M9 19.5H4.5V15\",\n bell: \"M6 16.5V11a6 6 0 0 1 12 0v5.5l1.5 1.5h-15zM10 20.5a2 2 0 0 0 4 0\",\n check: \"M5 12.5l4.5 4.5L19 7.5\",\n};\n\nfunction Icon({\n name,\n size = 20,\n color,\n sw = 1.75,\n fill = \"none\",\n}: {\n name: string;\n size?: number;\n color: string;\n sw?: number;\n fill?: string;\n}) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill={fill}\n stroke={color}\n strokeWidth={sw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={{ display: \"block\", flexShrink: 0 }}\n aria-hidden\n >\n <path d={ICON[name]} />\n </svg>\n );\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 RemocnR({ height, color }: { height: number; color: string }) {\n return (\n <svg\n viewBox=\"0 0 124.06 134.26\"\n height={height}\n width={(height * 124.06) / 134.26}\n style={{ display: \"block\" }}\n aria-hidden\n >\n <path fill={color} d={REMOCN_R_PATH} />\n </svg>\n );\n}\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\ninterface Key {\n f: number;\n x: number;\n y: number;\n bend?: number;\n}\nfunction along(keys: Key[], f: number) {\n if (f <= keys[0].f) return { x: keys[0].x, y: keys[0].y };\n for (let i = 0; i < keys.length - 1; i++) {\n const a = keys[i];\n const b = keys[i + 1];\n if (f >= b.f) continue;\n const t = MOVE(clamp((f - a.f) / (b.f - a.f)));\n const bend = b.bend ?? 0;\n const cx = (a.x + b.x) / 2 - (b.y - a.y) * bend;\n const cy = (a.y + b.y) / 2 + (b.x - a.x) * bend;\n const m = 1 - t;\n return {\n x: m * m * a.x + 2 * m * t * cx + t * t * b.x,\n y: m * m * a.y + 2 * m * t * cy + t * t * b.y,\n };\n }\n const last = keys[keys.length - 1];\n return { x: last.x, y: last.y };\n}\n\nfunction Cursor({\n x,\n y,\n press,\n opacity,\n}: {\n x: number;\n y: number;\n press: number;\n opacity: number;\n}) {\n return (\n <svg\n width={24}\n height={24}\n viewBox=\"0 0 24 24\"\n aria-hidden\n style={{\n position: \"absolute\",\n left: x - 2,\n top: y - 2,\n overflow: \"visible\",\n opacity,\n transform: `scale(${1 - press * 0.12})`,\n transformOrigin: \"2px 2px\",\n filter: \"drop-shadow(0 2px 4px rgba(0,0,0,0.3))\",\n zIndex: 60,\n }}\n >\n <path\n d=\"M1 1 L1 18.5 L5.6 14.4 L8.7 21.6 L11.6 20.4 L8.5 13.2 L14.5 13.2 Z\"\n fill=\"#FFFFFF\"\n stroke=\"#111111\"\n strokeWidth={1.1}\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nconst CHAPTERS = [\n { at: 0, name: \"Intro\" },\n { at: 0.14, name: \"Kinetic captions\" },\n { at: 0.38, name: \"Transitions\" },\n { at: 0.62, name: \"Templates\" },\n { at: 0.84, name: \"Pricing\" },\n];\nconst DURATION = 138;\nconst TRANSCRIPT = [\n { at: 30, text: \"Every scene is a React component you own.\" },\n { at: 33, text: \"Captions follow the voice-over, word by word.\" },\n { at: 36, text: \"Change the copy, hit render, and you’re done.\" },\n { at: 40, text: \"Same props, same timing, every single time.\" },\n];\n\nconst SCENES = [\n [\"Hook\", \"#E5484D\"],\n [\"Product\", \"#3E63DD\"],\n [\"Proof\", \"#30A46C\"],\n [\"CTA\", \"#F76B15\"],\n];\nconst TRACKS = [\n [\n [0, 0.22, \"Hook\", \"#E5484D\"],\n [0.22, 0.58, \"Product walkthrough\", \"#3E63DD\"],\n [0.58, 0.8, \"Proof\", \"#30A46C\"],\n [0.8, 1, \"CTA\", \"#F76B15\"],\n ],\n [\n [0.04, 0.36, \"Kinetic captions\", \"#8E4EC6\"],\n [0.42, 0.9, \"Kinetic captions\", \"#8E4EC6\"],\n ],\n [[0, 1, \"launch-theme.mp3\", \"#6E6E76\"]],\n] as const;\nconst WORDS = [\"Ship\", \"it\", \"today.\"];\n\nfunction EditorScene({ frame, accent }: { frame: number; accent: string }) {\n const push = 1 + 0.035 * clamp(frame / 300);\n const head = ((frame * 0.0022 + 0.31) % 1) * 1;\n const word = Math.floor(frame / 9) % WORDS.length;\n const win = { x: 64, y: 30, w: 708, h: 384 };\n const side = 150;\n const tlH = 104;\n return (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n overflow: \"hidden\",\n background:\n \"radial-gradient(120% 90% at 50% 0%, #22242C 0%, #0B0C10 70%)\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: win.x,\n top: win.y,\n width: win.w,\n height: win.h,\n borderRadius: 10,\n overflow: \"hidden\",\n background: \"#FFFFFF\",\n boxShadow:\n \"0 0 0 1px rgba(255,255,255,0.1), 0 24px 60px rgba(0,0,0,0.55)\",\n transform: `scale(${push})`,\n transformOrigin: \"50% 40%\",\n color: \"#1C1C1F\",\n fontSize: 11,\n }}\n >\n <div\n style={{\n height: 28,\n background: \"#F3F3F5\",\n borderBottom: \"1px solid rgba(0,0,0,0.07)\",\n display: \"flex\",\n alignItems: \"center\",\n gap: 6,\n padding: \"0 10px\",\n }}\n >\n {[\"#FF5F57\", \"#FEBC2E\", \"#28C840\"].map((c) => (\n <div\n key={c}\n style={{ width: 9, height: 9, borderRadius: 5, background: c }}\n />\n ))}\n <div style={{ flex: 1, textAlign: \"center\", color: \"#6E6E76\" }}>\n remocn studio · launch-video.tsx\n </div>\n <div\n style={{\n height: 18,\n padding: \"0 8px\",\n borderRadius: 5,\n background: accent,\n color: \"#fff\",\n fontWeight: 400,\n fontSize: 10,\n display: \"flex\",\n alignItems: \"center\",\n }}\n >\n Render\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 28,\n width: side,\n bottom: tlH,\n borderRight: \"1px solid rgba(0,0,0,0.07)\",\n padding: \"10px 8px\",\n boxSizing: \"border-box\",\n }}\n >\n <div\n style={{\n color: \"#8B8B93\",\n fontWeight: 400,\n fontSize: 10,\n padding: \"0 6px 6px\",\n }}\n >\n Scenes\n </div>\n {SCENES.map(([n, c], i) => (\n <div\n key={n}\n style={{\n height: 24,\n borderRadius: 5,\n display: \"flex\",\n alignItems: \"center\",\n gap: 7,\n padding: \"0 6px\",\n background: i === 1 ? \"rgba(0,0,0,0.05)\" : \"transparent\",\n fontWeight: 400,\n }}\n >\n <div\n style={{ width: 8, height: 8, borderRadius: 2, background: c }}\n />\n {n}\n <span style={{ marginLeft: \"auto\", color: \"#A1A1A8\" }}>\n {[\"0:04\", \"0:11\", \"0:06\", \"0:05\"][i]}\n </span>\n </div>\n ))}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: side,\n right: 0,\n top: 28,\n bottom: tlH,\n background: \"#F6F6F7\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <div\n style={{\n width: 384,\n height: 216,\n borderRadius: 4,\n background: \"#101014\",\n boxShadow: \"0 1px 3px rgba(0,0,0,0.2)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 10,\n }}\n >\n {WORDS.map((w, i) => (\n <div\n key={w}\n style={{\n fontSize: 38,\n fontWeight: 400,\n letterSpacing: \"-0.03em\",\n color: i === word ? \"#101014\" : \"#FFFFFF\",\n background: i === word ? \"#D4F56A\" : \"transparent\",\n borderRadius: 6,\n padding: \"0 6px\",\n transform: `scale(${i === word ? 1.04 : 1})`,\n }}\n >\n {w}\n </div>\n ))}\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n bottom: 0,\n height: tlH,\n borderTop: \"1px solid rgba(0,0,0,0.08)\",\n background: \"#FFFFFF\",\n }}\n >\n <div\n style={{\n height: 18,\n display: \"flex\",\n color: \"#A1A1A8\",\n fontSize: 9,\n fontVariantNumeric: \"tabular-nums\",\n padding: \"0 0 0 12px\",\n alignItems: \"center\",\n }}\n >\n {Array.from({ length: 9 }, (_, i) => (\n <div key={`t${i}`} style={{ flex: 1 }}>\n 0:{String(i * 4).padStart(2, \"0\")}\n </div>\n ))}\n </div>\n {TRACKS.map((track, ti) => (\n <div\n key={`tr${ti}`}\n style={{\n position: \"relative\",\n height: 22,\n margin: \"3px 12px 0\",\n }}\n >\n {track.map(([a0, a1, label, c]) => (\n <div\n key={`${label}${a0}`}\n style={{\n position: \"absolute\",\n left: `${a0 * 100}%`,\n width: `calc(${(a1 - a0) * 100}% - 2px)`,\n top: 0,\n bottom: 0,\n borderRadius: 4,\n background: mix(c, \"#FFFFFF\", 0.82),\n boxShadow: `inset 0 0 0 1px ${mix(c, \"#FFFFFF\", 0.45)}`,\n color: mix(c, \"#000000\", 0.35),\n fontSize: 9.5,\n fontWeight: 400,\n padding: \"0 6px\",\n display: \"flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n }}\n >\n {label}\n </div>\n ))}\n </div>\n ))}\n <div\n style={{\n position: \"absolute\",\n top: 4,\n bottom: 4,\n left: `calc(12px + ${head} * (100% - 24px))`,\n width: 1.5,\n background: \"#E5484D\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n top: -1,\n left: -4,\n width: 9,\n height: 9,\n borderRadius: 2,\n background: \"#E5484D\",\n }}\n />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\nexport function VideoWatchPage({\n title = \"Introducing remocn 2.0\",\n channel,\n stats,\n src,\n children,\n accent = \"#3B5BFD\",\n speed = 1,\n theme = \"light\",\n ground,\n groundParams,\n}: VideoWatchPageProps) {\n const frame = useCurrentFrame() * speed;\n const { width, height, fps } = useVideoConfig();\n const dark = theme === \"dark\";\n const pal = dark ? DARK : LIGHT;\n const tall = height > width;\n const DW = tall ? 720 : 1280;\n const DH = tall ? 1280 : 720;\n const u = Math.min(width / DW, height / DH);\n const L = tall\n ? {\n win: { x: 70, y: 140, w: 580, h: 1000 },\n player: { x: 20, y: 80, w: 540, h: 304 },\n meta: { x: 20, y: 404 },\n side: { x: 20, y: 576, w: 540 },\n lines: 2,\n }\n : {\n win: { x: 136, y: 50, w: 1008, h: 620 },\n player: { x: 24, y: 80, w: 576, h: 324 },\n meta: { x: 24, y: 422 },\n side: { x: 628, y: 80, w: 356 },\n lines: 3,\n };\n const PW = L.player.w;\n const PH = L.player.h;\n const metaW = L.player.w;\n const ch = { name: \"remocn\", subscribers: 18200, color: accent, ...channel };\n const st: WatchStats = {\n likesFrom: 1200,\n likesTo: 24000,\n viewsFrom: 12408,\n viewsTo: 1200000,\n commentsFrom: 1248,\n commentsTo: 1316,\n ...stats,\n };\n const sp = (at: number, config: object = CARD) =>\n spring({ frame: frame - at, fps, config });\n const ease = (a: number, b: number, e = ENTER) =>\n interpolate(frame, [a, b], [0, 1], { ...CL, easing: e });\n const press = (at: number) =>\n Math.max(\n 0,\n spring({ frame: frame - at, fps, config: CHIP }) -\n spring({ frame: frame - at - 5, fps, config: CHIP }),\n );\n\n const winIn = sp(0, HEAVY);\n const cam = interpolate(frame, [LIKE_CLICK, END], [1, 1.03], {\n ...CL,\n easing: CAMERA,\n });\n\n const seconds = 30 + frame / 30;\n const vt = clamp(seconds / DURATION);\n const hover =\n ease(HOVER_IN - 6, HOVER_IN + 4, RISE) *\n (1 - ease(HOVER_OUT, HOVER_OUT + 8, EXIT));\n const ctrlShow = Math.max(hover, 1 - ease(18, 28, EXIT));\n\n const subbed = frame >= SUB_CLICK + 1;\n const subPop = sp(SUB_CLICK + 1, CHIP);\n const bellT = frame - SUB_CLICK - 4;\n const bellRot =\n bellT > 0 ? Math.sin(bellT * 1.2) * 18 * Math.exp(-bellT * 0.1) : 0;\n const subs = subbed\n ? ch.subscribers + 100 * ease(SUB_CLICK, SUB_CLICK + 20, RISE)\n : ch.subscribers;\n\n const liked = frame >= LIKE_CLICK + 1;\n const likePop = sp(LIKE_CLICK + 1, CHIP);\n const STEPS = 14;\n const stepF = ease(LIKE_CLICK + 2, LIKE_CLICK + 42, RISE) * STEPS;\n const stepI = Math.floor(stepF);\n const stepFrac = clamp((stepF - stepI) * 3);\n const likeAt = (i: number) =>\n compact(expLerp(st.likesFrom, st.likesTo, clamp(i / STEPS)));\n const rollP = !liked || stepI === 0 || stepI >= STEPS ? 1 : stepFrac;\n\n const vT = ease(LIKE_CLICK + 6, LIKE_CLICK + 70, MOVE);\n const views =\n vT >= 1\n ? `${compact(st.viewsTo)} views`\n : `${group(expLerp(st.viewsFrom, st.viewsTo, vT))} views`;\n\n const barL = L.player.x + 14;\n const barW = PW - 28;\n const barY = L.player.y + PH - 52;\n const rowY = L.meta.y + 44;\n const subBtn = { x: L.meta.x + 252, y: rowY + 20 };\n const likeBtn = { x: L.meta.x + metaW - 70, y: rowY + 20 };\n const keys: Key[] = [\n { f: 8, x: L.win.w * 0.86, y: L.win.h * 0.92 },\n { f: HOVER_IN, x: barL + barW * 0.3, y: barY + 2, bend: 0.14 },\n { f: HOVER_OUT - 8, x: barL + barW * 0.68, y: barY + 1 },\n { f: SUB_CLICK - 2, x: subBtn.x, y: subBtn.y, bend: 0.16 },\n { f: SUB_CLICK + 8, x: subBtn.x + 4, y: subBtn.y + 3 },\n { f: LIKE_CLICK - 2, x: likeBtn.x, y: likeBtn.y, bend: -0.18 },\n { f: LIKE_CLICK + 24, x: likeBtn.x + 50, y: likeBtn.y + 60, bend: 0.1 },\n ];\n const cur = along(keys, frame);\n const curPress = Math.max(press(SUB_CLICK), press(LIKE_CLICK));\n const hoverT = clamp((cur.x - barL) / barW);\n const chapterOf = (t: number) =>\n CHAPTERS.reduce((a, c, i) => (t >= c.at ? i : a), 0);\n const chapterI = chapterOf(vt);\n const hoverI = chapterOf(hoverT);\n const mmss = (s: number) =>\n `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, \"0\")}`;\n const lineI = TRANSCRIPT.reduce((a, l, i) => (seconds >= l.at ? i : a), 0);\n\n const inner = (f: number) =>\n children ? (\n <div style={{ position: \"absolute\", inset: 0 }}>{children}</div>\n ) : src ? (\n <Img\n src={src}\n style={{\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n }}\n />\n ) : (\n <EditorScene frame={f} accent={accent} />\n );\n const scaled = (w: number, f: number) => (\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n width: 836,\n height: 470,\n transform: `scale(${w / 836})`,\n transformOrigin: \"0 0\",\n }}\n >\n {inner(f)}\n </div>\n );\n\n const rise = (at: number, dist = 14): React.CSSProperties => {\n const p = sp(at, CARD);\n return {\n opacity: Math.min(1, p * 1.5),\n transform: `translateY(${(1 - p) * dist}px)`,\n };\n };\n\n const pill: React.CSSProperties = {\n height: 40,\n borderRadius: 20,\n display: \"flex\",\n alignItems: \"center\",\n gap: 8,\n fontSize: 16,\n fontWeight: 400,\n whiteSpace: \"nowrap\",\n };\n\n return (\n <AbsoluteFill style={{ fontFamily, overflow: \"hidden\" }}>\n <GshGround\n preset={ground ?? \"film-blue\"}\n params={\n groundParams ??\n (dark\n ? undefined\n : {\n background: \"#eef1f6\",\n colors: [\"#ffffff\", \"#b4cdf0\", \"#6f9ad8\", \"#e3e9f3\"],\n grain: 0.05,\n })\n }\n timeOffset={dark ? 2 : 4}\n timeScale={0.35}\n />\n <AbsoluteFill style={{ background: pal.scrim }} />\n <div\n style={{\n position: \"absolute\",\n left: (width - DW * u) / 2,\n top: (height - DH * u) / 2,\n width: DW,\n height: DH,\n transformOrigin: \"0 0\",\n transform: `scale(${u})`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: L.win.x,\n top: L.win.y,\n width: L.win.w,\n height: L.win.h,\n transform: `translateY(${(1 - winIn) * 80}px) scale(${(0.96 + 0.04 * winIn) * cam})`,\n transformOrigin: \"50% 60%\",\n opacity: Math.min(1, winIn * 2),\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 18,\n background: pal.win,\n boxShadow: pal.shadow,\n overflow: \"hidden\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: 0,\n height: 60,\n display: \"flex\",\n alignItems: \"center\",\n padding: \"0 24px\",\n gap: 14,\n borderBottom: `1px solid ${pal.hair}`,\n }}\n >\n <RemocnLogo fontSize={22} color={pal.text} />\n <span style={{ fontSize: 16, color: pal.faint }}>/</span>\n <span style={{ fontSize: 16, color: pal.muted }}>\n Launch videos\n </span>\n <div style={{ flex: 1 }} />\n <div\n style={{\n ...pill,\n height: 36,\n padding: \"0 16px 0 13px\",\n background: accent,\n color: \"#fff\",\n }}\n >\n <Icon name=\"share\" size={18} color=\"#fff\" />\n Share\n </div>\n <div\n style={{\n width: 32,\n height: 32,\n borderRadius: 16,\n background: \"linear-gradient(140deg,#e6b08f,#a9654a)\",\n boxShadow: \"inset 0 0 0 1px rgba(0,0,0,0.1)\",\n }}\n />\n </div>\n\n <div\n style={{\n position: \"absolute\",\n left: L.player.x,\n top: L.player.y,\n width: PW,\n height: PH,\n borderRadius: 12,\n overflow: \"hidden\",\n background: \"#000\",\n boxShadow: dark\n ? \"0 0 0 1px rgba(255,255,255,0.08)\"\n : \"0 0 0 1px rgba(0,0,0,0.08)\",\n }}\n >\n {scaled(PW, frame)}\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n bottom: 0,\n height: 120,\n background:\n \"linear-gradient(180deg, transparent, rgba(0,0,0,0.25) 40%, rgba(0,0,0,0.7))\",\n opacity: Math.max(ctrlShow, 0.6),\n }}\n />\n <div\n style={{\n position: \"absolute\",\n left: 14 + clamp(hoverT * barW - 80, 0, barW - 160),\n top: PH - 52 - 132,\n width: 160,\n opacity: hover,\n transform: `translateY(${(1 - hover) * 8}px) scale(${0.94 + 0.06 * hover})`,\n transformOrigin: \"50% 100%\",\n }}\n >\n <div\n style={{\n position: \"relative\",\n width: 160,\n height: 90,\n borderRadius: 8,\n overflow: \"hidden\",\n background: \"#000\",\n boxShadow:\n \"0 0 0 1.5px rgba(255,255,255,0.9), 0 10px 24px rgba(0,0,0,0.45)\",\n }}\n >\n {scaled(160, Math.round(hoverT * 900))}\n </div>\n <div\n style={{\n marginTop: 8,\n textAlign: \"center\",\n fontSize: 16,\n color: \"#fff\",\n textShadow: \"0 1px 4px rgba(0,0,0,0.6)\",\n whiteSpace: \"nowrap\",\n }}\n >\n {CHAPTERS[hoverI].name}\n <span\n style={{ fontFamily: mono, opacity: 0.75, marginLeft: 8 }}\n >\n {mmss(hoverT * DURATION)}\n </span>\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 14,\n right: 14,\n top: PH - 52,\n height: 4 + hover * 2,\n display: \"flex\",\n gap: 3,\n }}\n >\n {CHAPTERS.map((c, i) => {\n const end = CHAPTERS[i + 1]?.at ?? 1;\n const seg = (x: number) => clamp((x - c.at) / (end - c.at));\n return (\n <div\n key={c.name}\n style={{\n position: \"relative\",\n flex: end - c.at,\n borderRadius: 2,\n background: \"rgba(255,255,255,0.28)\",\n overflow: \"hidden\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n width: `${seg(hover > 0 ? hoverT : 0) * 100}%`,\n background: \"rgba(255,255,255,0.55)\",\n opacity: hover,\n }}\n />\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n width: `${seg(vt) * 100}%`,\n background: \"#fff\",\n }}\n />\n </div>\n );\n })}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 16,\n right: 16,\n bottom: 10,\n height: 30,\n display: \"flex\",\n alignItems: \"center\",\n gap: 16,\n color: \"#fff\",\n fontSize: 16,\n }}\n >\n <Icon name=\"pause\" size={20} color=\"#fff\" sw={2} />\n <Icon name=\"vol\" size={20} color=\"#fff\" />\n <span\n style={{\n fontFamily: mono,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n {mmss(seconds)} / {mmss(DURATION)}\n </span>\n <span style={{ color: \"rgba(255,255,255,0.75)\" }}>\n {CHAPTERS[chapterI].name}\n </span>\n <div style={{ flex: 1 }} />\n <Icon name=\"cc\" size={20} color=\"#fff\" />\n <Icon name=\"full\" size={20} color=\"#fff\" />\n </div>\n </div>\n\n <div\n style={{\n position: \"absolute\",\n left: L.meta.x,\n top: L.meta.y,\n width: metaW,\n fontSize: 26,\n fontWeight: 400,\n letterSpacing: \"-0.02em\",\n color: pal.text,\n whiteSpace: \"nowrap\",\n ...rise(8),\n }}\n >\n {title}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: L.meta.x,\n top: rowY,\n width: metaW,\n height: 40,\n display: \"flex\",\n alignItems: \"center\",\n ...rise(12),\n }}\n >\n <div\n style={{\n width: 40,\n height: 40,\n borderRadius: 20,\n background: ch.color,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n flexShrink: 0,\n }}\n >\n <RemocnR height={17} color=\"#fff\" />\n </div>\n <div style={{ marginLeft: 12, width: 132 }}>\n <div style={{ fontSize: 17, color: pal.text, lineHeight: 1.2 }}>\n {ch.name}\n </div>\n <div\n style={{\n fontSize: 15.5,\n color: pal.muted,\n fontVariantNumeric: \"tabular-nums\",\n lineHeight: 1.3,\n }}\n >\n {compact(subs)} subscribers\n </div>\n </div>\n <div\n style={{\n ...pill,\n padding: subbed ? \"0 16px 0 12px\" : \"0 18px\",\n background: subbed ? pal.surface : pal.strong,\n color: subbed ? pal.text : pal.onStrong,\n transform: `scale(${(1 - 0.04 * press(SUB_CLICK)) * (subbed ? 0.94 + 0.06 * subPop : 1)})`,\n }}\n >\n {subbed ? (\n <>\n <div\n style={{\n transform: `rotate(${bellRot}deg)`,\n transformOrigin: \"50% 15%\",\n }}\n >\n <Icon name=\"bell\" size={18} color={pal.text} />\n </div>\n Subscribed\n </>\n ) : (\n \"Subscribe\"\n )}\n </div>\n <div style={{ flex: 1 }} />\n <div\n style={{\n ...pill,\n width: 124,\n boxSizing: \"border-box\",\n padding: \"0 16px 0 14px\",\n background: liked\n ? `color-mix(in oklab, ${accent} ${dark ? 22 : 12}%, ${pal.surface})`\n : pal.surface,\n color: liked ? (dark ? \"#fff\" : accent) : pal.text,\n transform: `scale(${1 - 0.04 * press(LIKE_CLICK)})`,\n }}\n >\n <div\n style={{\n transform: `scale(${liked ? 0.8 + 0.2 * likePop : 1}) rotate(${liked ? (1 - likePop) * -14 : 0}deg)`,\n }}\n >\n <Icon\n name=\"like\"\n size={20}\n color={liked ? (dark ? \"#fff\" : accent) : pal.text}\n fill={liked ? (dark ? \"#fff\" : accent) : \"none\"}\n />\n </div>\n <div\n style={{\n position: \"relative\",\n height: 22,\n overflow: \"hidden\",\n flex: 1,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n top: 0,\n lineHeight: \"22px\",\n transform: `translateY(${(1 - rollP) * 12}px)`,\n opacity: rollP < 1 ? Math.min(1, rollP * 1.4) : 1,\n }}\n >\n {likeAt(liked ? stepI : 0)}\n </div>\n {rollP < 1 ? (\n <div\n style={{\n position: \"absolute\",\n top: 0,\n lineHeight: \"22px\",\n transform: `translateY(${-rollP * 12}px)`,\n opacity: Math.max(0, 1 - rollP * 2.5),\n }}\n >\n {likeAt(stepI - 1)}\n </div>\n ) : null}\n </div>\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: L.meta.x,\n top: rowY + 58,\n width: metaW,\n boxSizing: \"border-box\",\n borderRadius: 12,\n background: pal.surface,\n padding: \"12px 16px\",\n fontSize: 16,\n lineHeight: \"23px\",\n color: pal.muted,\n ...rise(16),\n }}\n >\n <div\n style={{ color: pal.text, fontVariantNumeric: \"tabular-nums\" }}\n >\n {views}\n <span style={{ color: pal.muted, marginLeft: 12 }}>\n 3 hours ago\n </span>\n </div>\n <div\n style={{\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n }}\n >\n Kinetic captions, 40+ transitions, one install command.\n </div>\n </div>\n\n <div\n style={{\n position: \"absolute\",\n left: L.side.x,\n top: L.side.y,\n width: L.side.w,\n }}\n >\n <div\n style={{\n fontSize: 16,\n color: pal.muted,\n height: 28,\n ...rise(6),\n }}\n >\n Chapters\n </div>\n {CHAPTERS.map((c, i) => {\n const active = i === chapterI;\n const hovered = hover > 0.05 && i === hoverI && !active;\n return (\n <div\n key={c.name}\n style={{\n height: 44,\n display: \"flex\",\n alignItems: \"center\",\n gap: 14,\n padding: \"0 12px\",\n margin: \"0 -12px\",\n borderRadius: 10,\n background: active\n ? pal.surface\n : hovered\n ? `color-mix(in oklab, ${pal.surface} ${Math.round(hover * 55)}%, transparent)`\n : \"transparent\",\n ...rise(8 + i * 2, 10),\n }}\n >\n <span\n style={{\n fontFamily: mono,\n fontSize: 16,\n width: 48,\n color: active ? accent : pal.faint,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n {mmss(c.at * DURATION)}\n </span>\n <span\n style={{\n fontSize: 16.5,\n color: active || hovered ? pal.text : pal.muted,\n }}\n >\n {c.name}\n </span>\n </div>\n );\n })}\n <div\n style={{\n height: 1,\n background: pal.hair,\n margin: \"16px 0 16px\",\n ...rise(18),\n }}\n />\n <div\n style={{\n fontSize: 16,\n color: pal.muted,\n height: 28,\n ...rise(18),\n }}\n >\n Transcript\n </div>\n {TRANSCRIPT.slice(\n Math.min(lineI, TRANSCRIPT.length - L.lines),\n Math.min(lineI, TRANSCRIPT.length - L.lines) + L.lines,\n ).map((l) => {\n const on = seconds >= l.at && l === TRANSCRIPT[lineI];\n return (\n <div\n key={l.at}\n style={{\n display: \"flex\",\n gap: 14,\n padding: \"8px 0\",\n ...rise(20, 10),\n }}\n >\n <span\n style={{\n fontFamily: mono,\n fontSize: 16,\n width: 48,\n flexShrink: 0,\n color: on ? accent : pal.faint,\n lineHeight: \"23px\",\n }}\n >\n {mmss(l.at)}\n </span>\n <span\n style={{\n fontSize: 16.5,\n lineHeight: \"23px\",\n color: on ? pal.text : pal.muted,\n textWrap: \"pretty\",\n }}\n >\n {l.text}\n </span>\n </div>\n );\n })}\n </div>\n </div>\n <Cursor x={cur.x} y={cur.y} press={curPress} opacity={ease(8, 16)} />\n </div>\n </div>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/video-watch-page.tsx"
}
],
"type": "registry:component"
}