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": "year-in-review",
"title": "Year in Review",
"description": "A bold story card with 2026 stats is presented with a Share this story button.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/year-in-review/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadDisplay } from \"@remotion/google-fonts/BricolageGrotesque\";\nimport { loadFont } from \"@remotion/google-fonts/HankenGrotesk\";\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 { fontFamily } = loadFont(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst { fontFamily: display } = loadDisplay(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\n\nexport interface CrewMember {\n name: string;\n color: string;\n}\n\nexport interface YearInReviewStats {\n year: string;\n product: string;\n videos: number;\n topComponent: string;\n runnersUp: string[];\n percentile: number;\n minutes: string;\n crew: CrewMember[];\n url: string;\n}\n\nexport interface YearInReviewProps {\n stats?: Partial<YearInReviewStats>;\n accent?: string;\n speed?: number;\n device?: \"phone\" | \"card\";\n chapters?: string[];\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst DEFAULT_STATS: YearInReviewStats = {\n year: \"2026\",\n product: \"remocn\",\n videos: 42,\n topComponent: \"Kinetic captions\",\n runnersUp: [\"Zoom blur\", \"Bento build\", \"Logo wall\"],\n percentile: 3,\n minutes: \"1,284\",\n crew: [\n { name: \"Maya Chen\", color: \"#F2994A\" },\n { name: \"Leo Park\", color: \"#5B8DEF\" },\n { name: \"Priya Raman\", color: \"#E05A7A\" },\n { name: \"Sam Okafor\", color: \"#2BB3A3\" },\n { name: \"Noor Haddad\", color: \"#9B6CF0\" },\n { name: \"Iris Vale\", color: \"#D4A72C\" },\n ],\n url: \"remocn.dev/wrapped\",\n};\n\nconst SW = 393;\nconst SH = 852;\nconst BEZEL = 11;\nconst STARTS = [0, 78, 156, 252, 360];\nconst TR = 18;\nconst INK = \"#121212\";\nconst CREAM = \"#F6F1E7\";\nconst LIME = \"#CDF564\";\nconst PINK = \"#FF9BDB\";\nconst ORANGE = \"#FF6B35\";\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));\nconst outCubic = Easing.bezier(0.22, 1, 0.36, 1);\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\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 };\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 hash = (n: number) => {\n const s = Math.sin(n * 127.1 + 311.7) * 43758.5453;\n return s - Math.floor(s);\n};\n\ninterface Ctx {\n lf: number;\n fps: number;\n s: YearInReviewStats;\n accent: string;\n top: number;\n}\n\nconst pop = (c: Ctx, at: number, config: typeof CARD = CARD) =>\n spring({ frame: c.lf - at, fps: c.fps, config });\n\nfunction Display({\n children,\n size,\n color,\n style,\n}: {\n children: React.ReactNode;\n size: number;\n color: string;\n style?: React.CSSProperties;\n}) {\n return (\n <div\n style={{\n fontFamily: display,\n fontWeight: 400,\n fontSize: size,\n lineHeight: 0.92,\n letterSpacing: -size * 0.045,\n color,\n ...style,\n }}\n >\n {children}\n </div>\n );\n}\n\nfunction Rise({\n t,\n children,\n style,\n}: {\n t: number;\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) {\n return (\n <div style={{ overflow: \"hidden\", paddingBottom: 6, ...style }}>\n <div style={{ transform: `translateY(${(1 - t) * 110}%)` }}>\n {children}\n </div>\n </div>\n );\n}\n\nfunction starPoints(n: number, r1: number, r2: number, rot: number) {\n return Array.from({ length: n * 2 }, (_, i) => {\n const r = i % 2 ? r2 : r1;\n const a = (i / (n * 2)) * Math.PI * 2 + rot;\n return `${50 + Math.cos(a) * r},${50 + Math.sin(a) * r}`;\n }).join(\" \");\n}\n\nfunction Shape({\n kind,\n color,\n size,\n}: {\n kind: \"circle\" | \"half\" | \"square\" | \"star\" | \"ring\" | \"pill\";\n color: string;\n size: number;\n}) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 100 100\"\n style={{ display: \"block\", overflow: \"visible\" }}\n >\n {kind === \"circle\" ? (\n <circle cx={50} cy={50} r={50} fill={color} />\n ) : null}\n {kind === \"half\" ? (\n <path d=\"M0 50 A50 50 0 0 1 100 50 Z\" fill={color} />\n ) : null}\n {kind === \"square\" ? (\n <rect x={6} y={6} width={88} height={88} rx={14} fill={color} />\n ) : null}\n {kind === \"star\" ? (\n <polygon points={starPoints(8, 50, 30, 0)} fill={color} />\n ) : null}\n {kind === \"ring\" ? (\n <circle\n cx={50}\n cy={50}\n r={42}\n fill=\"none\"\n stroke={color}\n strokeWidth={14}\n />\n ) : null}\n {kind === \"pill\" ? (\n <rect x={0} y={30} width={100} height={40} rx={20} fill={color} />\n ) : null}\n </svg>\n );\n}\n\nfunction Portrait({\n color,\n size,\n name,\n}: {\n color: string;\n size: number;\n name: string;\n}) {\n const initials = name\n .split(\" \")\n .map((w) => w[0])\n .join(\"\")\n .slice(0, 2);\n return (\n <div\n style={{\n width: size,\n height: size,\n background: mix(color, \"#1B1B1B\", 0.15),\n display: \"flex\",\n alignItems: \"flex-end\",\n padding: 8,\n boxSizing: \"border-box\",\n fontFamily: display,\n fontWeight: 300,\n fontSize: size * 0.42,\n letterSpacing: \"-0.04em\",\n lineHeight: 0.9,\n color: mix(color, \"#FFFFFF\", 0.75),\n }}\n >\n {initials}\n </div>\n );\n}\n\nconst SHAPES = [\n {\n kind: \"circle\",\n color: LIME,\n x: -30,\n y: 120,\n size: 170,\n from: [-300, -200],\n spin: 0,\n },\n {\n kind: \"half\",\n color: PINK,\n x: 250,\n y: 150,\n size: 170,\n from: [300, -160],\n spin: 180,\n },\n {\n kind: \"square\",\n color: ORANGE,\n x: -20,\n y: 600,\n size: 150,\n from: [-260, 300],\n spin: -120,\n },\n {\n kind: \"star\",\n color: \"accent\",\n x: 230,\n y: 610,\n size: 200,\n from: [260, 300],\n spin: 200,\n },\n {\n kind: \"ring\",\n color: CREAM,\n x: 300,\n y: 262,\n size: 64,\n from: [200, 0],\n spin: 0,\n },\n {\n kind: \"pill\",\n color: LIME,\n x: 124,\n y: 530,\n size: 104,\n from: [-200, 80],\n spin: -90,\n },\n] as const;\n\nfunction Intro(c: Ctx) {\n const t1 = pop(c, 14, CARD);\n const t2 = pop(c, 20, CARD);\n return (\n <>\n {SHAPES.map((sh, i) => {\n const p = pop(c, 2 + i * 3, CHIP);\n const float = Math.sin((c.lf + i * 20) * 0.06) * 6;\n return (\n <div\n key={sh.kind + i}\n style={{\n position: \"absolute\",\n left: sh.x + sh.from[0] * (1 - p),\n top: sh.y + sh.from[1] * (1 - p) + float,\n transform: `rotate(${sh.spin * (1 - p) + c.lf * (i % 2 ? 0.4 : -0.3)}deg) scale(${0.4 + 0.6 * p})`,\n }}\n >\n <Shape\n kind={sh.kind}\n color={sh.color === \"accent\" ? c.accent : sh.color}\n size={sh.size}\n />\n </div>\n );\n })}\n <div style={{ position: \"absolute\", left: 28, right: 28, top: 330 }}>\n <Rise t={t1}>\n <Display size={136} color={CREAM}>\n {c.s.year}\n </Display>\n </Rise>\n <Rise t={t2}>\n <Display size={62} color={CREAM} style={{ marginTop: 4 }}>\n in {c.s.product}\n </Display>\n </Rise>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 28,\n bottom: 44,\n fontSize: 17,\n fontWeight: 400,\n color: CREAM,\n opacity: interpolate(c.lf, [34, 44], [0, 1], CL),\n }}\n >\n Let’s see what you shipped →\n </div>\n </>\n );\n}\n\nfunction Shipped(c: Ctx) {\n const slam = interpolate(c.lf, [4, 11], [0, 1], {\n ...CL,\n easing: Easing.bezier(0.55, 0, 1, 0.45),\n });\n const settle = pop(c, 11, CHIP);\n const scale = c.lf < 11 ? 3.2 - 2.2 * slam : 1 + (1 - settle) * -0.06;\n const shake =\n c.lf >= 11\n ? Math.sin((c.lf - 11) * 2.6) * 7 * Math.exp(-(c.lf - 11) * 0.4)\n : 0;\n const tiles = Math.min(c.s.videos, 42);\n return (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n transform: `translate(${shake}px, ${shake * 0.6}px)`,\n }}\n >\n <div style={{ position: \"absolute\", left: 28, top: c.top + 70 }}>\n <Rise t={pop(c, 0, CARD)}>\n <Display size={40} color={INK}>\n You shipped\n </Display>\n </Rise>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: c.top + 120,\n display: \"flex\",\n justifyContent: \"center\",\n transform: `scale(${scale})`,\n opacity: clamp(slam * 3),\n filter: `blur(${(1 - slam) * 6}px)`,\n }}\n >\n <Display size={250} color={INK}>\n {c.s.videos}\n </Display>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 28,\n right: 28,\n top: c.top + 360,\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"baseline\",\n }}\n >\n <Rise t={pop(c, 14, CARD)}>\n <Display size={60} color={INK}>\n videos\n </Display>\n </Rise>\n <div\n style={{\n fontSize: 17,\n fontWeight: 400,\n color: INK,\n opacity: interpolate(c.lf, [20, 28], [0, 1], CL),\n }}\n >\n one every 8.7 days\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 28,\n top: c.top + 448,\n width: 337,\n display: \"grid\",\n gridTemplateColumns: \"repeat(7, 1fr)\",\n gap: 6,\n }}\n >\n {Array.from({ length: tiles }, (_, i) => {\n const p = pop(c, 18 + i * 0.6, CARD);\n const tone = [INK, c.accent, ORANGE, INK, PINK, INK][\n Math.floor(hash(i) * 6)\n ];\n return (\n <div\n key={`t${i}`}\n style={{\n height: 32,\n borderRadius: i % 5 === 2 ? 16 : 7,\n background: tone,\n opacity: clamp(p * 2),\n transform: `scale(${0.5 + 0.5 * p}) rotate(${(1 - p) * 30}deg)`,\n }}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nfunction TopComponent(c: Ctx) {\n const words = [\"ship\", \"it\", \"today.\"];\n const stack = [\n { rot: -7, dx: -12, col: PINK, at: 10 },\n { rot: 5, dx: 14, col: LIME, at: 15 },\n { rot: -1.5, dx: 0, col: INK, at: 20 },\n ];\n return (\n <>\n <div\n style={{ position: \"absolute\", left: 28, right: 28, top: c.top + 64 }}\n >\n <div\n style={{\n fontSize: 15,\n fontWeight: 400,\n color: PINK,\n letterSpacing: 0.4,\n textTransform: \"uppercase\",\n opacity: interpolate(c.lf, [2, 8], [0, 1], CL),\n }}\n >\n Your top component\n </div>\n <Rise t={pop(c, 4, CARD)} style={{ marginTop: 10 }}>\n <Display size={58} color=\"#fff\">\n {c.s.topComponent}\n </Display>\n </Rise>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 46,\n top: c.top + 230,\n width: 300,\n height: 190,\n }}\n >\n {stack.map((k, i) => {\n const p = pop(c, k.at, CARD);\n return (\n <div\n key={k.col}\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 22,\n background: k.col,\n transform: `translate(${k.dx}px, ${(1 - p) * -420}px) rotate(${k.rot + (1 - p) * 18}deg) scale(${1 + (1 - p) * 0.3})`,\n boxShadow: \"0 18px 40px rgba(0,0,0,0.25)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 10,\n }}\n >\n {i === 2\n ? words.map((w, j) => {\n const on = pop(c, 30 + j * 7, CHIP);\n const hot =\n c.lf >= 30 && Math.floor((c.lf - 30) / 7) % 3 === j;\n return (\n <div\n key={w}\n style={{\n fontFamily: display,\n fontWeight: 400,\n fontSize: 42,\n letterSpacing: -1.5,\n color: hot ? INK : \"#fff\",\n background: hot ? LIME : \"transparent\",\n borderRadius: 10,\n padding: \"0 6px\",\n transform: `scale(${on}) translateY(${(1 - on) * 20}px)`,\n }}\n >\n {w}\n </div>\n );\n })\n : null}\n </div>\n );\n })}\n </div>\n <div\n style={{ position: \"absolute\", left: 28, right: 28, top: c.top + 470 }}\n >\n {c.s.runnersUp.slice(0, 3).map((name, i) => {\n const p = pop(c, 40 + i * 6, CARD);\n return (\n <div\n key={name}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 16,\n height: 64,\n borderTop: \"1.5px solid rgba(255,255,255,0.25)\",\n transform: `translateX(${(1 - p) * 360}px)`,\n }}\n >\n <Display size={34} color={PINK} style={{ width: 30 }}>\n {i + 2}\n </Display>\n <div\n style={{\n width: 44,\n height: 44,\n borderRadius: 10,\n background: [LIME, ORANGE, CREAM][i],\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <Shape\n kind={([\"star\", \"ring\", \"square\"] as const)[i]}\n color={INK}\n size={22}\n />\n </div>\n <div style={{ flex: 1 }}>\n <div style={{ fontSize: 18, fontWeight: 400, color: \"#fff\" }}>\n {name}\n </div>\n <div\n style={{\n fontSize: 13,\n color: \"rgba(255,255,255,0.7)\",\n marginTop: 2,\n }}\n >\n in {[14, 9, 6][i]} videos\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </>\n );\n}\n\nfunction Percentile(c: Ctx) {\n const big = pop(c, 3, CHIP);\n const draw = interpolate(c.lf, [14, 64], [0, 1], { ...CL, easing: outCubic });\n const strip = interpolate(c.lf, [2, 28], [1, 0], { ...CL, easing: outCubic });\n return (\n <>\n <div\n style={{\n position: \"absolute\",\n right: 0,\n top: c.top + 336,\n width: 44,\n bottom: 0,\n transform: `translateY(${strip * 600}px)`,\n }}\n >\n {Array.from({ length: 22 }, (_, i) =>\n (i + Math.floor(i / 2)) % 2 === 0 ? (\n <div\n key={`c${i}`}\n style={{\n position: \"absolute\",\n left: (i % 2) * 22,\n top: Math.floor(i / 2) * 44,\n width: 22,\n height: 44,\n background: CREAM,\n }}\n />\n ) : null,\n )}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: c.top + 60,\n textAlign: \"center\",\n }}\n >\n <Rise t={pop(c, 0, CARD)}>\n <Display size={30} color={CREAM}>\n You’re in great company.\n </Display>\n </Rise>\n <div\n style={{\n display: \"flex\",\n justifyContent: \"center\",\n marginTop: 14,\n opacity: clamp(big * 2),\n transform: `scale(${0.6 + 0.4 * big}) rotate(${(1 - big) * -8}deg)`,\n }}\n >\n <Display\n size={170}\n color=\"#8FB4FF\"\n style={{\n WebkitTextStroke: `4px ${CREAM}`,\n textShadow: `6px 6px 0 ${c.accent}`,\n }}\n >\n {c.s.percentile}%\n </Display>\n </div>\n <div\n style={{\n fontSize: 16,\n color: CREAM,\n marginTop: 10,\n opacity: interpolate(c.lf, [14, 22], [0, 1], CL),\n }}\n >\n Top {c.s.percentile}% of {c.s.product} builders this year.\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 24,\n top: c.top + 352,\n opacity: interpolate(c.lf, [18, 26], [0, 1], CL),\n }}\n >\n <Display size={24} color={CREAM}>\n Your crew\n </Display>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 24,\n top: c.top + 392,\n width: 290,\n display: \"grid\",\n gridTemplateColumns: \"repeat(3, 1fr)\",\n gap: 12,\n }}\n >\n {c.s.crew.slice(0, 6).map((m, i) => {\n const p = pop(c, 22 + i * 3, CARD);\n return (\n <div\n key={m.name}\n style={{\n background: CREAM,\n padding: 4,\n opacity: clamp(p * 2),\n transform: `scale(${0.7 + 0.3 * p}) rotate(${(1 - p) * (i % 2 ? 14 : -14) + (i % 3 === 1 ? 2 : -1.5)}deg)`,\n boxShadow: \"0 6px 16px rgba(0,0,0,0.35)\",\n }}\n >\n <Portrait color={m.color} size={80} name={m.name} />\n <div\n style={{\n fontSize: 10.5,\n fontWeight: 400,\n color: INK,\n padding: \"5px 2px 2px\",\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n }}\n >\n {m.name}\n </div>\n </div>\n );\n })}\n </div>\n <svg\n width={SW}\n height={200}\n viewBox=\"0 0 393 200\"\n style={{ position: \"absolute\", left: 0, bottom: -40 }}\n >\n <path\n d=\"M-10 150 C 40 60, 90 200, 120 130 S 70 40, 40 120 S 180 210, 230 150 S 330 60, 410 120\"\n fill=\"none\"\n stroke={CREAM}\n strokeWidth={3}\n strokeLinecap=\"round\"\n pathLength={1}\n strokeDasharray={1}\n strokeDashoffset={1 - draw}\n />\n </svg>\n </>\n );\n}\n\nfunction Share(c: Ctx) {\n const card = pop(c, 12, CARD);\n const tapAt = 66;\n const press = interpolate(\n c.lf,\n [tapAt - 2, tapAt, tapAt + 4, tapAt + 8],\n [0, 1, 1, 0],\n CL,\n );\n const burst = clamp((c.lf - tapAt) / 22);\n const rows = [\n [\"Videos shipped\", String(c.s.videos)],\n [\"Top component\", c.s.topComponent],\n [\"Minutes rendered\", c.s.minutes],\n [\"Builder rank\", `Top ${c.s.percentile}%`],\n ];\n return (\n <>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: c.top + 52,\n textAlign: \"center\",\n opacity: interpolate(c.lf, [6, 14], [0, 1], CL),\n }}\n >\n <Display size={30} color={INK}>\n That’s a wrap.\n </Display>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 46,\n top: c.top + 110,\n width: 300,\n height: 476,\n borderRadius: 26,\n background: INK,\n overflow: \"hidden\",\n transform: `translateY(${(1 - card) * 500}px) rotate(${(1 - card) * 16 - 2 + (c.lf > tapAt ? Math.sin((c.lf - tapAt) * 0.5) * 1.5 * (1 - burst) : 0)}deg)`,\n boxShadow: \"0 30px 60px rgba(0,0,0,0.35)\",\n }}\n >\n <div\n style={{\n position: \"relative\",\n height: 170,\n background: c.accent,\n overflow: \"hidden\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: -30,\n top: -40,\n transform: `rotate(${c.lf * 0.6}deg)`,\n }}\n >\n <Shape kind=\"star\" color={LIME} size={150} />\n </div>\n <div style={{ position: \"absolute\", right: -40, bottom: -60 }}>\n <Shape kind=\"circle\" color={PINK} size={150} />\n </div>\n <div style={{ position: \"absolute\", left: 22, bottom: 18 }}>\n <Display size={22} color=\"#fff\">\n My\n </Display>\n <Display size={54} color=\"#fff\">\n {c.s.year}\n </Display>\n </div>\n </div>\n <div style={{ padding: \"16px 22px 0\" }}>\n {rows.map(([k, v], i) => (\n <div\n key={k}\n style={{\n padding: \"9px 0\",\n borderBottom:\n i < 3 ? \"1px solid rgba(255,255,255,0.12)\" : \"none\",\n opacity: interpolate(\n c.lf,\n [14 + i * 3, 20 + i * 3],\n [0, 1],\n CL,\n ),\n }}\n >\n <div\n style={{\n fontSize: 11.5,\n fontWeight: 400,\n color: \"rgba(255,255,255,0.6)\",\n }}\n >\n {k}\n </div>\n <div\n style={{\n fontFamily: display,\n fontWeight: 400,\n fontSize: 22,\n color: [LIME, PINK, CREAM, \"#8FB4FF\"][i],\n letterSpacing: -0.6,\n marginTop: 1,\n }}\n >\n {v}\n </div>\n </div>\n ))}\n <div\n style={{\n fontSize: 12,\n fontWeight: 400,\n color: \"rgba(255,255,255,0.55)\",\n marginTop: 10,\n }}\n >\n {c.s.url}\n </div>\n </div>\n </div>\n {burst > 0 && burst < 1\n ? Array.from({ length: 14 }, (_, i) => {\n const a = (i / 14) * Math.PI * 2 + hash(i) * 0.4;\n const d = 150 + hash(i + 7) * 130;\n return (\n <div\n key={`b${i}`}\n style={{\n position: \"absolute\",\n left: 196 + Math.cos(a) * d * outCubic(burst) - 9,\n top:\n c.top +\n 330 +\n Math.sin(a) * d * outCubic(burst) -\n 9 +\n burst * burst * 60,\n opacity: 1 - burst,\n transform: `rotate(${burst * 300 * (i % 2 ? 1 : -1)}deg)`,\n }}\n >\n <Shape\n kind={([\"star\", \"circle\", \"square\", \"pill\"] as const)[i % 4]}\n color={[LIME, c.accent, ORANGE, CREAM][i % 4]}\n size={18}\n />\n </div>\n );\n })\n : null}\n <div\n style={{\n position: \"absolute\",\n left: 96,\n right: 96,\n bottom: 48,\n height: 52,\n borderRadius: 999,\n background: INK,\n color: \"#fff\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 10,\n fontSize: 17,\n fontWeight: 400,\n transform: `translateY(${(1 - pop(c, 30, CARD)) * 120}px) scale(${1 - press * 0.06})`,\n }}\n >\n <svg\n width={18}\n height={18}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"#fff\"\n strokeWidth={2.2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 15V4M8 7.5 12 4l4 3.5M6 11v8.5h12V11\" />\n </svg>\n Share this story\n </div>\n </>\n );\n}\n\nconst SLIDES = [\n { bg: INK, body: Intro, ui: CREAM },\n { bg: LIME, body: Shipped, ui: INK },\n { bg: \"accent\", body: TopComponent, ui: \"#FFFFFF\" },\n { bg: \"#1B1B1B\", body: Percentile, ui: CREAM },\n { bg: PINK, body: Share, ui: INK },\n];\n\nfunction enterClip(i: number, e: number): React.CSSProperties {\n if (i === 1) return { clipPath: `circle(${e * 980}px at 50% 88%)` };\n if (i === 2) {\n const x = -40 + e * 180;\n return { clipPath: `polygon(0 0, ${x}% 0, ${x - 40}% 100%, 0 100%)` };\n }\n if (i === 3) return { opacity: clamp(e * 2.4) };\n return {};\n}\n\nfunction Screen({\n frame,\n fps,\n s,\n accent,\n top,\n}: {\n frame: number;\n fps: number;\n s: YearInReviewStats;\n accent: string;\n top: number;\n}) {\n let cur = 0;\n for (let i = 0; i < STARTS.length; i++) if (frame >= STARTS[i]) cur = i;\n const ui =\n SLIDES[cur > 0 && frame < STARTS[cur] + TR * 0.45 ? cur - 1 : cur].ui;\n const visible = SLIDES.map((_, i) => i).filter(\n (i) => i === cur || (i === cur - 1 && frame < STARTS[cur] + TR),\n );\n return (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n overflow: \"hidden\",\n background: INK,\n }}\n >\n {visible.map((i) => {\n const lf = frame - STARTS[i];\n const sl = SLIDES[i];\n const bg = sl.bg === \"accent\" ? accent : sl.bg;\n const e = spring({\n frame: lf,\n fps,\n config: HEAVY,\n durationInFrames: TR,\n });\n const leaving = i < cur ? clamp((frame - STARTS[cur]) / TR) : 0;\n const Body = sl.body;\n const circles = i === 4 && lf < TR + 6;\n return (\n <div\n key={`s${i}`}\n style={{\n position: \"absolute\",\n inset: 0,\n background: circles ? \"transparent\" : bg,\n overflow: \"hidden\",\n ...(i === cur && i > 0 ? enterClip(i, e) : {}),\n transform:\n i === cur && i === 3\n ? `scale(${1.05 - 0.05 * e})`\n : `scale(${1 - leaving * 0.08}) rotate(${leaving * (i % 2 ? 3 : -3)}deg)`,\n }}\n >\n {circles\n ? Array.from({ length: 30 }, (_, k) => {\n const col = k % 5;\n const row = Math.floor(k / 5);\n const p = spring({\n frame: lf - (5 - row) * 1.6 - col * 0.6,\n fps,\n config: CHIP,\n });\n return (\n <div\n key={`c${k}`}\n style={{\n position: \"absolute\",\n left: col * 80 - 40 + 39,\n top: row * 150 - 80 + 75,\n width: 160,\n height: 160,\n marginLeft: -80,\n marginTop: -80,\n borderRadius: \"50%\",\n background: bg,\n border: `3px solid ${CREAM}`,\n transform: `scale(${p * 1.3})`,\n }}\n />\n );\n })\n : null}\n <Body lf={lf} fps={fps} s={s} accent={accent} top={top} />\n </div>\n );\n })}\n <div\n style={{\n position: \"absolute\",\n left: 14,\n right: 14,\n top: top - 40,\n display: \"flex\",\n gap: 4,\n zIndex: 5,\n }}\n >\n {SLIDES.map((_, i) => {\n const len = (STARTS[i + 1] ?? STARTS[i] + 110) - STARTS[i];\n const fill = clamp((frame - STARTS[i]) / len);\n return (\n <div\n key={`p${i}`}\n style={{\n flex: 1,\n height: 3,\n borderRadius: 2,\n background:\n ui === INK ? \"rgba(18,18,18,0.22)\" : \"rgba(255,255,255,0.3)\",\n overflow: \"hidden\",\n }}\n >\n <div\n style={{\n width: `${fill * 100}%`,\n height: \"100%\",\n background: ui,\n }}\n />\n </div>\n );\n })}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 18,\n right: 18,\n top: top - 26,\n height: 30,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n zIndex: 5,\n }}\n >\n <div\n style={{\n fontFamily: display,\n fontWeight: 400,\n fontSize: 18,\n letterSpacing: -0.6,\n color: ui,\n }}\n >\n {s.product}\n </div>\n <div style={{ display: \"flex\", gap: 16 }}>\n <svg\n width={20}\n height={20}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={ui}\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"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 </svg>\n <svg\n width={20}\n height={20}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={ui}\n strokeWidth={2.2}\n strokeLinecap=\"round\"\n >\n <path d=\"M6 6l12 12M18 6 6 18\" />\n </svg>\n </div>\n </div>\n </div>\n );\n}\n\nfunction StatusBar({ color }: { color: string }) {\n return (\n <div\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n height: 54,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n padding: \"6px 34px 0 50px\",\n zIndex: 8,\n }}\n >\n <span style={{ fontSize: 17, fontWeight: 400, color }}>9:41</span>\n <div style={{ display: \"flex\", gap: 6, alignItems: \"center\" }}>\n <svg width=\"18\" height=\"12\" viewBox=\"0 0 18 12\">\n {[0, 1, 2, 3].map((i) => (\n <rect\n key={i}\n x={i * 4.6}\n y={9 - i * 3}\n width={3.2}\n height={3 + i * 3}\n rx={0.8}\n fill={color}\n />\n ))}\n </svg>\n <div\n style={{\n width: 25,\n height: 12,\n borderRadius: 3.5,\n border: `1px solid ${color}`,\n padding: 1.5,\n boxSizing: \"border-box\",\n }}\n >\n <div\n style={{\n width: \"78%\",\n height: \"100%\",\n borderRadius: 2,\n background: color,\n }}\n />\n </div>\n </div>\n </div>\n );\n}\n\nexport function YearInReview({\n stats,\n accent = \"#3B5BFD\",\n speed = 1,\n device = \"phone\",\n chapters = [\"Your year\", \"Shipped\", \"Top component\", \"Your rank\", \"Share\"],\n ground,\n groundParams,\n}: YearInReviewProps) {\n const frame = useCurrentFrame() * speed;\n const { width, height, fps } = useVideoConfig();\n const tall = height > width;\n const s = { ...DEFAULT_STATS, ...stats };\n const phone = device === \"phone\";\n let cur = 0;\n for (let i = 0; i < STARTS.length; i++) if (frame >= STARTS[i]) cur = i;\n const enter = spring({ frame, fps, config: HEAVY });\n const fw = phone ? SW + BEZEL * 2 : SW;\n const fh = phone ? SH + BEZEL * 2 : SH;\n const k = tall ? (height * 0.62) / fh : (height * 0.9) / fh;\n const center = tall\n ? { x: width / 2, y: height * 0.37 }\n : { x: width * 0.66, y: height / 2 };\n const u = width / (tall ? 1080 : 1280);\n const push = 1 + 0.02 * (frame / 480);\n const ui =\n SLIDES[cur > 0 && frame < STARTS[cur] + TR * 0.45 ? cur - 1 : cur].ui;\n const act = (i: number) =>\n interpolate(\n frame,\n [\n STARTS[i],\n STARTS[i] + 12,\n STARTS[i + 1] ?? 1e9,\n (STARTS[i + 1] ?? 1e9) + 8,\n ],\n [0, 1, 1, 0],\n { ...CL, easing: ENTER },\n );\n const railIn = interpolate(frame, [6, 22], [0, 1], { ...CL, easing: ENTER });\n const rail = tall ? (\n <div\n style={{\n position: \"absolute\",\n left: 80 * u,\n right: 80 * u,\n top: height * 0.735,\n }}\n >\n <div\n style={{\n display: \"flex\",\n gap: 8 * u,\n marginBottom: 28 * u,\n opacity: railIn,\n }}\n >\n {chapters.map((ch, i) => (\n <div\n key={ch}\n style={{\n flex: 1,\n height: 3 * u,\n borderRadius: 2,\n background: \"rgba(255,255,255,0.18)\",\n overflow: \"hidden\",\n }}\n >\n <div\n style={{\n width: `${clamp((frame - STARTS[i]) / ((STARTS[i + 1] ?? STARTS[i] + 120) - STARTS[i])) * 100}%`,\n height: \"100%\",\n background: \"#F4F1EA\",\n }}\n />\n </div>\n ))}\n </div>\n {chapters.map((ch, i) => {\n const a = act(i);\n if (a <= 0) return null;\n return (\n <div\n key={ch}\n style={{ position: \"absolute\", left: 0, right: 0, top: 40 * u }}\n >\n <div\n style={{\n fontSize: 28 * u,\n color: \"rgba(244,241,234,0.55)\",\n fontVariantNumeric: \"tabular-nums\",\n opacity: a,\n }}\n >\n 0{i + 1} / 0{chapters.length}\n </div>\n <div style={{ overflow: \"hidden\", paddingBottom: 10 * u }}>\n <div\n style={{\n marginTop: 10 * u,\n fontFamily: display,\n fontSize: 104 * u,\n fontWeight: 300,\n lineHeight: 1,\n letterSpacing: \"-0.045em\",\n color: \"#F4F1EA\",\n transform: `translateY(${(1 - a) * 105}%)`,\n }}\n >\n {ch}\n </div>\n </div>\n </div>\n );\n })}\n </div>\n ) : (\n <div\n style={{\n position: \"absolute\",\n left: 96 * u,\n top: height / 2 - 170 * u,\n width: 420 * u,\n }}\n >\n <div\n style={{\n fontSize: 20 * u,\n color: \"rgba(244,241,234,0.55)\",\n marginBottom: 22 * u,\n opacity: railIn,\n transform: `translateY(${(1 - railIn) * 10}px)`,\n }}\n >\n {s.year} in {s.product}\n </div>\n {chapters.map((ch, i) => {\n const a = act(i);\n const shown = interpolate(frame, [8 + i * 3, 22 + i * 3], [0, 1], {\n ...CL,\n easing: ENTER,\n });\n return (\n <div\n key={ch}\n style={{\n display: \"flex\",\n alignItems: \"baseline\",\n gap: 18 * u,\n height: 62 * u,\n opacity: shown * (0.32 + 0.68 * a),\n transform: `translateX(${a * 14 * u + (1 - shown) * 20}px)`,\n }}\n >\n <span\n style={{\n width: 34 * u,\n fontSize: 18 * u,\n color: \"rgba(244,241,234,0.6)\",\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n 0{i + 1}\n </span>\n <span\n style={{\n fontFamily: display,\n fontSize: 44 * u,\n fontWeight: 300,\n letterSpacing: \"-0.04em\",\n color: \"#F4F1EA\",\n }}\n >\n {ch}\n </span>\n </div>\n );\n })}\n </div>\n );\n return (\n <AbsoluteFill style={{ fontFamily, overflow: \"hidden\" }}>\n <GshGround\n preset={ground ?? \"charcoal-satin\"}\n params={groundParams}\n timeOffset={3}\n timeScale={0.3}\n />\n <AbsoluteFill\n style={{\n background: tall\n ? \"linear-gradient(180deg, rgba(6,6,8,0.15) 40%, rgba(6,6,8,0.7) 100%)\"\n : \"linear-gradient(90deg, rgba(6,6,8,0.72) 0%, rgba(6,6,8,0.25) 50%, rgba(6,6,8,0.1) 100%)\",\n }}\n />\n {rail}\n <div\n style={{\n position: \"absolute\",\n left: center.x - fw / 2,\n top: center.y - fh / 2,\n width: fw,\n height: fh,\n transform: `translateY(${(1 - enter) * height * 0.7}px) scale(${k * push})`,\n }}\n >\n {phone ? (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 66,\n background: \"#0B0B0C\",\n boxShadow:\n \"inset 0 0 0 1.5px #6E6E73, inset 0 0 0 3px #1C1C1E, 0 50px 100px -20px rgba(0,0,0,0.75)\",\n }}\n />\n ) : null}\n <div\n style={{\n position: \"absolute\",\n left: phone ? BEZEL : 0,\n top: phone ? BEZEL : 0,\n width: SW,\n height: SH,\n borderRadius: phone ? 55 : 30,\n overflow: \"hidden\",\n boxShadow: phone\n ? \"none\"\n : \"0 0 0 1px rgba(255,255,255,0.08), 0 50px 100px -20px rgba(0,0,0,0.75)\",\n }}\n >\n <Screen\n frame={frame}\n fps={fps}\n s={s}\n accent={accent}\n top={phone ? 104 : 64}\n />\n {phone ? (\n <>\n <StatusBar color={ui} />\n <div\n style={{\n position: \"absolute\",\n top: 11,\n left: (SW - 126) / 2,\n width: 126,\n height: 37,\n borderRadius: 19,\n background: \"#000\",\n zIndex: 20,\n }}\n />\n <div\n style={{\n position: \"absolute\",\n bottom: 8,\n left: (SW - 140) / 2,\n width: 140,\n height: 5,\n borderRadius: 3,\n background: ui,\n opacity: 0.85,\n zIndex: 20,\n }}\n />\n </>\n ) : null}\n </div>\n </div>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/year-in-review.tsx"
}
],
"type": "registry:component"
}