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": "leaderboard-climb",
"title": "Leaderboard Climb",
"description": "A launch leaderboard ranks ten products and the highlighted row climbs the table.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/leaderboard-climb/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadMono } from \"@remotion/google-fonts/GeistMono\";\nimport { loadFont as loadOnest } from \"@remotion/google-fonts/Onest\";\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 onest = loadOnest(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst mono = loadMono(\"normal\", { weights: [\"400\"], subsets: [\"latin\"] });\n\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst MOVE = Easing.bezier(0.65, 0, 0.35, 1);\nconst CAM = Easing.bezier(0.87, 0, 0.13, 1);\nconst CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\nconst LIFT = { mass: 0.6, damping: 15, stiffness: 230 };\n\nconst B = {\n self: -6,\n steps: [16, 28, 38, 46, 53, 59],\n payoff: 68,\n end: 120,\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\nconst ramp = (f: number, start: number, dur: number, easing = ENTER) =>\n interpolate(f, [start, start + dur], [0, 1], {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n easing,\n });\n\nconst mix = (a: number, b: number, t: number) => a + (b - a) * t;\n\nconst line = (color: string, w = 1.5) => ({\n fill: \"none\",\n stroke: color,\n strokeWidth: w,\n strokeLinecap: \"round\" as const,\n strokeLinejoin: \"round\" as const,\n});\n\nconst fmt = (n: number) => Math.round(n).toLocaleString(\"en-US\");\n\nconst TINTS = [\n \"#e8a33d\",\n \"#4f8cff\",\n \"#a77bff\",\n \"#3fb37f\",\n \"#ff6b6b\",\n \"#2fc4c4\",\n \"#f08a4b\",\n \"#8f9bb3\",\n];\n\nexport interface LeaderboardEntry {\n name: string;\n tagline: string;\n score: number;\n}\n\nexport interface LeaderboardClimbProps {\n theme?: \"dark\" | \"light\";\n accent?: string;\n title?: string;\n subtitle?: string;\n entries?: LeaderboardEntry[];\n self?: { name: string; tagline: string; from: number; to: number };\n toRank?: number;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nexport function LeaderboardClimb({\n theme = \"dark\",\n accent = \"#3B5BFD\",\n title = \"Top launches\",\n subtitle = \"Today · Launch league\",\n entries = [\n { name: \"Fieldnote\", tagline: \"Notes that write back\", score: 2140 },\n { name: \"Parcel\", tagline: \"Ship docs as sites\", score: 1866 },\n { name: \"Nightjar\", tagline: \"A calm inbox for teams\", score: 1210 },\n { name: \"Orbitdesk\", tagline: \"Async standups\", score: 1098 },\n { name: \"Lumen\", tagline: \"Analytics without SQL\", score: 964 },\n { name: \"Tally Run\", tagline: \"Budgets for builders\", score: 880 },\n { name: \"Stackbird\", tagline: \"Previews for every branch\", score: 742 },\n { name: \"Coda Room\", tagline: \"Rooms for pair coding\", score: 655 },\n ],\n self = {\n name: \"remocn\",\n tagline: \"Launch videos from code\",\n from: 598,\n to: 1284,\n },\n toRank = 3,\n ground,\n groundParams,\n}: LeaderboardClimbProps) {\n const frame = useCurrentFrame();\n const { width, height, fps } = useVideoConfig();\n const dark = theme === \"dark\";\n const portrait = height > width * 1.2;\n const stageW = portrait ? 720 : 1280;\n const stageH = portrait ? 1280 : 720;\n const k = width / stageW;\n\n const ink = dark ? \"#f1f2f8\" : \"#15161c\";\n const muted = dark ? \"rgba(236,238,248,0.52)\" : \"rgba(21,22,28,0.5)\";\n const faint = dark ? \"rgba(236,238,248,0.3)\" : \"rgba(21,22,28,0.3)\";\n const hair = dark ? \"rgba(255,255,255,0.08)\" : \"rgba(21,22,28,0.08)\";\n const rowBg = dark ? \"rgba(255,255,255,0.035)\" : \"rgba(21,22,28,0.025)\";\n const surface = dark\n ? \"linear-gradient(180deg, rgba(24,26,36,0.9) 0%, rgba(12,13,19,0.94) 100%)\"\n : \"linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(250,250,252,0.96) 100%)\";\n const shadow = dark\n ? \"inset 0 1px 0 rgba(255,255,255,0.07), 0 1px 2px rgba(0,0,0,0.5), 0 20px 44px rgba(0,0,0,0.4), 0 70px 140px rgba(0,4,30,0.6)\"\n : \"inset 0 1px 0 #ffffff, 0 1px 2px rgba(20,30,80,0.06), 0 18px 40px rgba(20,30,80,0.08), 0 60px 130px rgba(20,30,80,0.16)\";\n\n const n = Math.min(8, entries.length);\n const others = entries.slice(0, n);\n const fromIdx = n;\n const toIdx = Math.max(0, Math.min(n, toRank - 1));\n const stepCount = fromIdx - toIdx;\n const steps = B.steps.slice(0, stepCount);\n\n const fs = portrait ? 1.12 : 1;\n const panelW = portrait ? 660 : 1040;\n const rowH = portrait ? 80 : 50;\n const slot = rowH + (portrait ? 8 : 6);\n const pad = portrait ? 24 : 26;\n const headH = portrait ? 150 : 88;\n const labelsH = 34;\n const listTop = pad + headH + labelsH;\n const panelH = listTop + slot * (n + 1) - (slot - rowH) + pad;\n const slotY = (s: number) => listTop + s * slot;\n\n const selfMoves = steps.map((t) =>\n spring({ frame: frame - t, fps, config: LIFT }),\n );\n const selfMovesPrev = steps.map((t) =>\n spring({ frame: frame - 1 - t, fps, config: LIFT }),\n );\n const selfSlot = fromIdx - selfMoves.reduce((a, b) => a + b, 0);\n const selfSlotPrev = fromIdx - selfMovesPrev.reduce((a, b) => a + b, 0);\n const selfV = Math.abs(selfSlot - selfSlotPrev) * slot;\n const selfBlur = Math.min(6, selfV * 0.18);\n const moving = Math.min(\n 1,\n selfMoves.reduce(\n (a, m, i) =>\n a + Math.sin(Math.PI * Math.min(1, m)) * (frame >= steps[i] ? 1 : 0),\n 0,\n ),\n );\n\n const scoreStops = [\n self.from,\n ...others\n .slice(toIdx, fromIdx)\n .reverse()\n .map((e) => e.score + 14),\n ];\n scoreStops[scoreStops.length - 1] = self.to;\n let score = self.from;\n steps.forEach((t, i) => {\n const p = ramp(frame, t - 2, 9, MOVE);\n score = mix(score, scoreStops[i + 1] ?? self.to, p);\n });\n const selfRank = Math.round(selfSlot) + 1;\n\n const payoff = spring({ frame: frame - B.payoff, fps, config: CHIP });\n const flash =\n ramp(frame, B.payoff, 4, MOVE) * (1 - ramp(frame, B.payoff + 4, 22, ENTER));\n const selfIn = ramp(frame, B.self, 12);\n\n const camPull = ramp(frame, steps[0] - 6, B.payoff + 4 - (steps[0] - 6), CAM);\n const panelCy = panelH / 2;\n const selfCenter = slotY(selfSlot) + rowH / 2;\n const z0 = portrait ? 1.08 : 1.2;\n const z1 = portrait ? 0.98 : 0.95;\n const z =\n mix(z0, z1, camPull) +\n 0.02 * ramp(frame, -6, steps[0], Easing.linear) * (1 - camPull) +\n 0.025 * ramp(frame, B.payoff, B.end - B.payoff, Easing.linear);\n const fy = mix(selfCenter - panelCy - (portrait ? 220 : 120), 0, camPull);\n const fx = 0;\n const rotX = mix(10, 4, camPull) + Math.sin(frame / 40) * 0.4;\n const rotY = mix(-8, -3, camPull) + 2 * moving;\n\n const resolvedPreset: GshPresetId | undefined =\n ground ?? (dark ? undefined : \"glasswork\");\n const resolvedParams: Partial<GradientParams> | undefined =\n groundParams ??\n (ground || !dark\n ? undefined\n : {\n kind: \"rise\",\n background: \"#02030a\",\n colors: [\"#eef2ff\", \"#7d95ff\", \"#2c3fc9\", \"#0a0f3a\"],\n });\n\n const medal = (rank: number) =>\n rank === 1\n ? \"#e9b949\"\n : rank === 2\n ? \"#b9c0cc\"\n : rank === 3\n ? \"#cf8a54\"\n : null;\n\n const rankCell = (rank: number, onAccent: boolean) => {\n const m = medal(rank);\n return (\n <div\n style={{\n width: 40 * fs,\n display: \"flex\",\n justifyContent: \"center\",\n flexShrink: 0,\n }}\n >\n {m ? (\n <div\n style={{\n width: 30 * fs,\n height: 30 * fs,\n borderRadius: 15 * fs,\n background: onAccent\n ? \"rgba(255,255,255,0.95)\"\n : `color-mix(in oklab, ${m} 22%, transparent)`,\n border: `1.5px solid ${m}`,\n color: onAccent ? \"#15161c\" : m,\n fontFamily: mono.fontFamily,\n fontSize: 15 * fs,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n {rank}\n </div>\n ) : (\n <span\n style={{\n fontFamily: mono.fontFamily,\n fontSize: 17 * fs,\n color: onAccent ? \"rgba(255,255,255,0.85)\" : muted,\n }}\n >\n {rank}\n </span>\n )}\n </div>\n );\n };\n\n const rowInner = (\n rank: number,\n avatar: React.ReactNode,\n name: string,\n tagline: string,\n scoreText: string,\n onAccent: boolean,\n trend: \"up\" | \"flat\" | \"down\",\n extra?: React.ReactNode,\n ) => (\n <>\n {rankCell(rank, onAccent)}\n {avatar}\n <div style={{ flex: 1, minWidth: 0 }}>\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 10,\n fontSize: 18 * fs,\n color: onAccent ? \"#ffffff\" : ink,\n letterSpacing: \"-0.01em\",\n whiteSpace: \"nowrap\",\n }}\n >\n {name}\n {portrait || rowH > 50 ? null : (\n <span\n style={{\n fontSize: 16,\n color: onAccent ? \"rgba(255,255,255,0.72)\" : muted,\n }}\n >\n {tagline}\n </span>\n )}\n {extra}\n </div>\n {portrait || rowH > 50 ? (\n <div\n style={{\n fontSize: 14 * fs,\n color: onAccent ? \"rgba(255,255,255,0.7)\" : muted,\n marginTop: 2,\n whiteSpace: \"nowrap\",\n }}\n >\n {tagline}\n </div>\n ) : null}\n </div>\n <span\n style={{\n fontFamily: mono.fontFamily,\n fontSize: 18 * fs,\n color: onAccent ? \"#ffffff\" : ink,\n fontVariantNumeric: \"tabular-nums\",\n minWidth: 80 * fs,\n textAlign: \"right\",\n }}\n >\n {scoreText}\n </span>\n <svg\n viewBox=\"0 0 24 24\"\n width={18 * fs}\n height={18 * fs}\n style={{ marginLeft: 10, flexShrink: 0 }}\n aria-hidden\n >\n <path\n d={\n trend === \"up\"\n ? \"M12 18V6M7 11l5-5 5 5\"\n : trend === \"down\"\n ? \"M12 6v12M7 13l5 5 5-5\"\n : \"M6 12h12\"\n }\n {...line(\n onAccent\n ? \"#ffffff\"\n : trend === \"up\"\n ? \"#3fb37f\"\n : trend === \"down\"\n ? \"#ff6b6b\"\n : faint,\n 1.8,\n )}\n />\n </svg>\n </>\n );\n\n return (\n <AbsoluteFill style={{ fontFamily: onest.fontFamily, overflow: \"hidden\" }}>\n <GshGround\n preset={resolvedPreset}\n params={resolvedParams}\n timeOffset={3}\n timeScale={0.45}\n />\n <svg width={0} height={0} style={{ position: \"absolute\" }} aria-hidden>\n <filter id=\"lbc-self\" x=\"-5%\" y=\"-40%\" width=\"110%\" height=\"180%\">\n <feGaussianBlur stdDeviation={`0 ${selfBlur}`} />\n </filter>\n </svg>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n width: stageW,\n height: stageH,\n transform: `scale(${k})`,\n transformOrigin: \"0 0\",\n perspective: 2000,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: stageW / 2,\n top: stageH / 2,\n width: 0,\n height: 0,\n transformStyle: \"preserve-3d\",\n transform: `translate(${-fx * z}px, ${-fy * z}px) rotateX(${rotX}deg) rotateY(${rotY}deg) scale(${z})`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: -panelW / 2,\n top: -panelH / 2,\n width: panelW,\n height: panelH,\n borderRadius: 26,\n background: surface,\n border: `1px solid ${hair}`,\n boxShadow: shadow,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: pad,\n right: pad,\n top: pad,\n height: headH,\n display: \"flex\",\n flexDirection: portrait ? \"column\" : \"row\",\n alignItems: portrait ? \"flex-start\" : \"center\",\n gap: portrait ? 18 : 0,\n }}\n >\n <div style={{ flex: portrait ? undefined : 1 }}>\n <div\n style={{\n fontSize: portrait ? 48 : 44,\n fontWeight: 300,\n color: ink,\n letterSpacing: \"-0.045em\",\n lineHeight: 1,\n }}\n >\n {title}\n </div>\n <div style={{ fontSize: 16 * fs, color: muted, marginTop: 10 }}>\n {subtitle}\n </div>\n </div>\n <div style={{ display: \"flex\", gap: 8 }}>\n {[\"Today\", \"Week\", \"Month\"].map((t, i) => (\n <span\n key={t}\n style={{\n height: 34 * fs,\n padding: `0 ${14 * fs}px`,\n borderRadius: 10,\n fontSize: 15 * fs,\n display: \"flex\",\n alignItems: \"center\",\n color: i === 0 ? ink : muted,\n background: i === 0 ? rowBg : \"transparent\",\n border: `1px solid ${i === 0 ? hair : \"transparent\"}`,\n }}\n >\n {t}\n </span>\n ))}\n <span\n style={{\n height: 34 * fs,\n padding: `0 ${12 * fs}px`,\n borderRadius: 10,\n border: `1px solid ${hair}`,\n display: \"flex\",\n alignItems: \"center\",\n gap: 8,\n fontFamily: mono.fontFamily,\n fontSize: 14 * fs,\n color: muted,\n marginLeft: 6,\n }}\n >\n <svg viewBox=\"0 0 24 24\" width={15} height={15} aria-hidden>\n <path\n d=\"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM12 8v4l2.5 2\"\n {...line(muted)}\n />\n </svg>\n 06:42:{String(18 - Math.floor(frame / 30)).padStart(2, \"0\")}\n </span>\n </div>\n </div>\n\n <div\n style={{\n position: \"absolute\",\n left: pad + 14,\n right: pad + 14,\n top: pad + headH,\n height: labelsH,\n display: \"flex\",\n alignItems: \"center\",\n gap: 14,\n fontFamily: mono.fontFamily,\n fontSize: 13 * fs,\n letterSpacing: \"0.06em\",\n color: faint,\n borderBottom: `1px solid ${hair}`,\n }}\n >\n <span style={{ width: 40 * fs, textAlign: \"center\" }}>#</span>\n <span style={{ flex: 1 }}>PRODUCT</span>\n <span style={{ marginRight: 28 * fs }}>UPVOTES</span>\n </div>\n\n {others.map((e, j) => {\n const stepI = fromIdx - 1 - j;\n const t =\n stepI >= 0 && stepI < steps.length ? steps[stepI] : null;\n const drop =\n t === null\n ? 0\n : spring({ frame: frame - t - 1, fps, config: CARD });\n const s = j + drop;\n const rank = Math.round(s) + 1;\n return (\n <div\n key={e.name}\n style={{\n position: \"absolute\",\n left: pad,\n right: pad,\n top: slotY(s),\n height: rowH,\n borderRadius: 14,\n background: rowBg,\n border: `1px solid ${hair}`,\n display: \"flex\",\n alignItems: \"center\",\n gap: 14,\n padding: \"0 16px 0 14px\",\n boxSizing: \"border-box\",\n opacity: 1 - 0.25 * Math.sin(Math.PI * Math.min(1, drop)),\n }}\n >\n {rowInner(\n rank,\n <div\n style={{\n width: (rowH > 60 ? 46 : 34) * 1,\n height: (rowH > 60 ? 46 : 34) * 1,\n borderRadius: 10,\n flexShrink: 0,\n background: `color-mix(in oklab, ${TINTS[j % TINTS.length]} ${dark ? 26 : 18}%, transparent)`,\n border: `1px solid color-mix(in oklab, ${TINTS[j % TINTS.length]} 40%, transparent)`,\n color: TINTS[j % TINTS.length],\n fontSize: 17 * fs,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n {e.name.slice(0, 1)}\n </div>,\n e.name,\n e.tagline,\n fmt(e.score),\n false,\n t !== null && frame >= t ? \"down\" : j < 2 ? \"up\" : \"flat\",\n )}\n </div>\n );\n })}\n\n <div\n style={{\n position: \"absolute\",\n left: pad - 6 * moving,\n right: pad - 6 * moving,\n top: slotY(selfSlot) - 2 * moving,\n height: rowH,\n borderRadius: 14,\n background: accent,\n display: \"flex\",\n alignItems: \"center\",\n gap: 14,\n padding: \"0 16px 0 14px\",\n boxSizing: \"border-box\",\n opacity: selfIn,\n transform: `scale(${1 + 0.02 * moving + 0.03 * flash})`,\n boxShadow: `inset 0 1px 0 rgba(255,255,255,0.25), 0 ${10 + 14 * moving}px ${26 + 24 * moving}px color-mix(in oklab, ${accent} ${45 + 20 * flash}%, transparent), 0 0 0 ${6 * flash}px color-mix(in oklab, ${accent} ${30 * flash}%, transparent)`,\n filter: selfBlur > 0.4 ? \"url(#lbc-self)\" : undefined,\n clipPath: `inset(0 ${100 - 100 * selfIn}% 0 0 round 14px)`,\n }}\n >\n {rowInner(\n selfRank,\n <div\n style={{\n width: rowH > 60 ? 46 : 34,\n height: rowH > 60 ? 46 : 34,\n borderRadius: 10,\n flexShrink: 0,\n background: \"#ffffff\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n boxShadow: \"0 2px 6px rgba(0,0,0,0.15)\",\n }}\n >\n <RemocnR height={rowH > 60 ? 22 : 17} color=\"#0b0c12\" />\n </div>,\n self.name,\n self.tagline,\n fmt(score),\n true,\n \"up\",\n <span\n style={{\n height: 24 * fs,\n padding: `0 ${9 * fs}px`,\n borderRadius: 8,\n background: \"rgba(255,255,255,0.2)\",\n color: \"#ffffff\",\n fontFamily: mono.fontFamily,\n fontSize: 13 * fs,\n display: \"flex\",\n alignItems: \"center\",\n gap: 4,\n opacity: frame >= B.payoff ? Math.min(1, payoff * 2) : 0,\n transform: `scale(${mix(0.5, 1, payoff)})`,\n }}\n >\n ▲ {stepCount} today\n </span>,\n )}\n </div>\n </div>\n </div>\n </div>\n </AbsoluteFill>\n );\n}\n\nexport default LeaderboardClimb;\n",
"type": "registry:component",
"target": "components/remocn/leaderboard-climb.tsx"
}
],
"type": "registry:component"
}