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": "ride-tracking",
"title": "Ride Tracking",
"description": "A phone map shows a driver arriving with a trip card sliding up.",
"dependencies": ["remotion", "@remotion/google-fonts", "@remotion/paths"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/ride-tracking/index.tsx",
"content": "\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/Onest\";\nimport {\n getLength,\n getPointAtLength,\n getTangentAtLength,\n} from \"@remotion/paths\";\nimport type React from \"react\";\nimport { useId } 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});\n\nexport interface RideDriver {\n name: string;\n initials: string;\n rating: number;\n trips: string;\n car: string;\n plate: string;\n}\n\nexport interface RideTrackingProps {\n driver?: RideDriver;\n /** Starting ETA in minutes; counts down to the arrival check. */\n eta?: number;\n /** Pickup street shown on the pin and in the sheet. */\n pickup?: string;\n accent?: string;\n speed?: number;\n theme?: \"light\" | \"dark\";\n /** Three lines beside the phone: route, drive, arrival. */\n lines?: [string, string, string];\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst DEFAULT_DRIVER: RideDriver = {\n name: \"Leo\",\n initials: \"LP\",\n rating: 4.92,\n trips: \"1,284 trips\",\n car: \"Grey Halcyon Aero\",\n plate: \"7KXR 284\",\n};\n\nconst SW = 393;\nconst SH = 852;\nconst BEZEL = 11;\nconst BW = SW + BEZEL * 2;\nconst BH = SH + BEZEL * 2;\nconst SHEET_Y = 556;\nconst FOCUS = { x: SW / 2, y: 300 };\n\nconst DRAW_AT = 14;\nconst DRAW_END = 42;\nconst DRIVE_AT = 52;\nconst DRIVE_END = 214;\n\nconst clamp = { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\" } as const;\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 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);\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 hash = (n: number) => {\n const x = Math.sin(n * 127.1 + 311.7) * 43758.5453;\n return x - Math.floor(x);\n};\n\nconst AVES = [-60, 130, 300, 470, 620, 790, 960];\nconst STREETS = [-40, 140, 300, 460, 620, 770, 940, 1100, 1260, 1420];\nconst MAJOR_AVES = new Set([300, 620]);\nconst MAJOR_STREETS = new Set([460, 940]);\nconst ROUTE_PTS: [number, number][] = [\n [300, 1030],\n [300, 620],\n [620, 620],\n [620, 460],\n [684, 460],\n];\nconst PICKUP = { x: 712, y: 460 };\nconst RIDER = { x: 724, y: 496 };\nconst PARK = { x: 300, y: 770, w: 170, h: 170 };\nconst LOT = { x: 470, y: 620, w: 150, h: 150 };\nconst RIVER = \"M -80 330 C 160 270, 380 450, 620 380 S 900 300, 1080 350\";\n\nfunction roundedPath(pts: [number, number][], r: number) {\n let d = `M ${pts[0][0]} ${pts[0][1]}`;\n for (let i = 1; i < pts.length - 1; i++) {\n const [px, py] = pts[i - 1];\n const [x, y] = pts[i];\n const [nx, ny] = pts[i + 1];\n const l1 = Math.hypot(x - px, y - py);\n const l2 = Math.hypot(nx - x, ny - y);\n const a = [x - ((x - px) / l1) * r, y - ((y - py) / l1) * r];\n const b = [x + ((nx - x) / l2) * r, y + ((ny - y) / l2) * r];\n d += ` L ${a[0]} ${a[1]} Q ${x} ${y} ${b[0]} ${b[1]}`;\n }\n const last = pts[pts.length - 1];\n return `${d} L ${last[0]} ${last[1]}`;\n}\nconst ROUTE = roundedPath(ROUTE_PTS, 22);\nconst ROUTE_LEN = getLength(ROUTE);\nconst routeLen = (len: number) => Math.max(0, Math.min(ROUTE_LEN - 0.01, len));\nconst routePoint = (len: number) =>\n getPointAtLength(ROUTE, routeLen(len)) ?? { x: PICKUP.x, y: PICKUP.y };\nconst routeTangent = (len: number) =>\n getTangentAtLength(ROUTE, routeLen(len)) ?? { x: 1, y: 0 };\n\nconst LIGHT = {\n ground: \"#eef0f2\",\n block: \"#e7e9ec\",\n building: \"#dde0e5\",\n buildingEdge: \"#d0d4da\",\n road: \"#ffffff\",\n roadEdge: \"#d6dae0\",\n major: \"#ffffff\",\n majorEdge: \"#c9ced6\",\n park: \"#cfe8cc\",\n parkPath: \"#e3f1df\",\n water: \"#aad3f0\",\n label: \"#5d636d\",\n route: \"#111111\",\n casing: \"#ffffff\",\n carBody: \"#fbfbfc\",\n carShade: \"#c9ccd2\",\n glass: \"#2b2f36\",\n sheet: \"#ffffff\",\n text: \"#111111\",\n muted: \"#6b6f76\",\n chip: \"#f1f2f4\",\n line: \"#ececee\",\n status: \"#111111\",\n copy: \"#141518\",\n copyMuted: \"rgba(20,21,24,0.46)\",\n scrim: \"rgba(243,241,237,0.3)\",\n frame:\n \"linear-gradient(155deg,#f1f1f3 0%,#c4c4ca 30%,#e2e2e6 62%,#b3b3ba 100%)\",\n phoneShadow:\n \"0 50px 90px -24px rgba(30,32,44,0.32), 0 14px 30px -10px rgba(30,32,44,0.18)\",\n poi: \"#7b818b\",\n hair: \"rgba(17,17,17,0.08)\",\n};\nconst DARK: typeof LIGHT = {\n ground: \"#1b1e23\",\n block: \"#1f2228\",\n building: \"#262a31\",\n buildingEdge: \"#2e333b\",\n road: \"#30353e\",\n roadEdge: \"#25292f\",\n major: \"#3b414b\",\n majorEdge: \"#2a2e35\",\n park: \"#1c3324\",\n parkPath: \"#23402c\",\n water: \"#132c44\",\n label: \"#8f96a1\",\n route: \"#ffffff\",\n casing: \"#0b0c0e\",\n carBody: \"#f4f4f5\",\n carShade: \"#a1a5ad\",\n glass: \"#1d2026\",\n sheet: \"#161719\",\n text: \"#f4f4f5\",\n muted: \"#9a9ea6\",\n chip: \"#232427\",\n line: \"#2a2b2f\",\n status: \"#ffffff\",\n copy: \"#f4f4f6\",\n copyMuted: \"rgba(244,244,246,0.5)\",\n scrim: \"rgba(2,3,8,0.3)\",\n frame:\n \"linear-gradient(155deg,#55565c 0%,#2a2b2f 30%,#3d3e43 62%,#1f2023 100%)\",\n phoneShadow:\n \"0 50px 100px -20px rgba(0,0,0,0.7), 0 18px 36px -12px rgba(0,0,0,0.5)\",\n poi: \"#6d737d\",\n hair: \"rgba(255,255,255,0.08)\",\n};\ntype Palette = typeof LIGHT;\n\nconst POIS = [\n {\n x: 395,\n y: 545,\n name: \"Halcyon Library\",\n glyph: \"M7 6h4v12H7zM13 6h4v12h-4z\",\n },\n {\n x: 540,\n y: 700,\n name: \"Fernway Coffee\",\n glyph: \"M6 9h10v5a4 4 0 01-4 4h-2a4 4 0 01-4-4zM16 10h2a2 2 0 010 4h-2\",\n },\n {\n x: 705,\n y: 560,\n name: \"Orbitly Fitness\",\n glyph: \"M5 12h14M7 8v8M17 8v8\",\n },\n {\n x: 222,\n y: 860,\n name: \"Tessel Market\",\n glyph: \"M6 8h12l-1 10H7zM9 8a3 3 0 016 0\",\n },\n {\n x: 870,\n y: 410,\n name: \"Pier 9\",\n glyph: \"M12 5v14M7 12a5 5 0 0010 0M9 7h6\",\n },\n];\nconst LABELS = [\n { x: 300, y: 860, text: \"Harbor Ave\", rot: -90 },\n { x: 620, y: 545, text: \"Quarry Ave\", rot: -90 },\n { x: 545, y: 460, text: \"Linden St\", rot: 0 },\n { x: 860, y: 460, text: \"Linden St\", rot: 0 },\n { x: 215, y: 140, text: \"Tessel Blvd\", rot: 0 },\n { x: 130, y: 700, text: \"Elm Ave\", rot: -90 },\n { x: 790, y: 700, text: \"Bay Ave\", rot: -90 },\n { x: 385, y: 1100, text: \"Grove St\", rot: 0 },\n { x: 545, y: 940, text: \"Ashby St\", rot: 0 },\n { x: 215, y: 620, text: \"Mercer St\", rot: 0 },\n { x: 470, y: 1180, text: \"Wren Ave\", rot: -90 },\n];\n\n/** Perimeter-block buildings: lots of varied width and depth around a courtyard. */\nfunction blockBuildings(\n x0: number,\n y0: number,\n w: number,\n h: number,\n seed: number,\n) {\n const out: { x: number; y: number; w: number; h: number }[] = [];\n const depth = (k: number) => 16 + hash(seed + k) * 16;\n const run = (\n len: number,\n k0: number,\n put: (at: number, size: number, k: number) => void,\n ) => {\n let at = 0;\n let k = k0;\n while (at < len - 6) {\n const size = Math.min(len - at, 14 + hash(seed + k * 3.1) * 30);\n if (hash(seed + k * 7.7) > 0.1) put(at, size - 2.5, k);\n at += size;\n k++;\n }\n };\n const top = depth(1);\n const bottom = depth(2);\n run(w, 10, (at, size, k) =>\n out.push({\n x: x0 + at,\n y: y0,\n w: size,\n h: top - (hash(seed + k) > 0.7 ? 5 : 0),\n }),\n );\n run(w, 40, (at, size, k) => {\n const d = bottom - (hash(seed + k) > 0.7 ? 5 : 0);\n out.push({ x: x0 + at, y: y0 + h - d, w: size, h: d });\n });\n const inner = h - top - bottom - 5;\n if (inner > 14) {\n run(inner, 70, (at, size, k) =>\n out.push({ x: x0, y: y0 + top + 2.5 + at, w: depth(k + 3), h: size }),\n );\n run(inner, 90, (at, size, k) => {\n const d = depth(k + 5);\n out.push({ x: x0 + w - d, y: y0 + top + 2.5 + at, w: d, h: size });\n });\n }\n return out;\n}\n\n/** Static vector map: blocks, park, river, roads, labels and POIs. */\nfunction MapArt({ c }: { c: Palette }) {\n const blocks: React.ReactNode[] = [];\n for (let i = 0; i < AVES.length - 1; i++) {\n for (let j = 0; j < STREETS.length - 1; j++) {\n const x0 = AVES[i] + 13;\n const y0 = STREETS[j] + 13;\n const w = AVES[i + 1] - AVES[i] - 26;\n const h = STREETS[j + 1] - STREETS[j] - 26;\n const key = `${i}-${j}`;\n if (AVES[i] === PARK.x && STREETS[j] === PARK.y) continue;\n blocks.push(\n <rect\n key={key}\n x={x0}\n y={y0}\n width={w}\n height={h}\n rx={3}\n fill={c.block}\n />,\n );\n if (AVES[i] === LOT.x && STREETS[j] === LOT.y) {\n for (let r = 0; r < 4; r++)\n blocks.push(\n <path\n key={`${key}l${r}`}\n d={`M ${x0 + 10} ${y0 + 16 + r * 29} h ${w - 20}`}\n stroke={c.buildingEdge}\n strokeWidth={12}\n strokeDasharray=\"1 8\"\n />,\n );\n continue;\n }\n for (const [n, b] of blockBuildings(\n x0,\n y0,\n w,\n h,\n i * 31 + j * 17,\n ).entries())\n blocks.push(\n <rect\n key={`${key}b${n}`}\n x={b.x}\n y={b.y}\n width={b.w}\n height={b.h}\n rx={1.5}\n fill={c.building}\n stroke={c.buildingEdge}\n strokeWidth={0.75}\n />,\n );\n }\n }\n const roads = (major: boolean, pass: 0 | 1) => {\n const w = (major ? 20 : 13) + (pass ? 0 : 2.5);\n const col = major\n ? pass\n ? c.major\n : c.majorEdge\n : pass\n ? c.road\n : c.roadEdge;\n return (\n <g key={`${major}${pass}`} stroke={col} strokeWidth={w}>\n {AVES.filter((x) => MAJOR_AVES.has(x) === major).map((x) => (\n <line key={`a${x}`} x1={x} y1={-400} x2={x} y2={2000} />\n ))}\n {STREETS.filter((y) => MAJOR_STREETS.has(y) === major).map((y) => (\n <line key={`s${y}`} x1={-400} y1={y} x2={1400} y2={y} />\n ))}\n </g>\n );\n };\n return (\n <g>\n <rect x={-400} y={-400} width={1800} height={2400} fill={c.ground} />\n {blocks}\n <rect\n x={PARK.x + 12}\n y={PARK.y + 12}\n width={PARK.w - 24}\n height={PARK.h - 24}\n rx={6}\n fill={c.park}\n />\n <path\n d={`M ${PARK.x + 20} ${PARK.y + 140} C ${PARK.x + 60} ${PARK.y + 80}, ${PARK.x + 110} ${PARK.y + 120}, ${PARK.x + 150} ${PARK.y + 30}`}\n stroke={c.parkPath}\n strokeWidth={5}\n fill=\"none\"\n strokeLinecap=\"round\"\n />\n {roads(false, 0)}\n {roads(false, 1)}\n <path d={RIVER} stroke={c.water} strokeWidth={58} fill=\"none\" />\n {roads(true, 0)}\n {roads(true, 1)}\n <text\n x={PARK.x + 85}\n y={PARK.y + 90}\n textAnchor=\"middle\"\n fontSize={10}\n fontWeight={400}\n fill={c.label}\n >\n Quarry Park\n </text>\n <text\n x={120}\n y={330}\n textAnchor=\"middle\"\n fontSize={10}\n fontStyle=\"italic\"\n fontWeight={400}\n fill={c.label}\n opacity={0.8}\n >\n Fern River\n </text>\n {LABELS.map((l) => (\n <text\n key={`${l.text}${l.x}${l.y}`}\n x={l.x}\n y={l.y}\n transform={`rotate(${l.rot} ${l.x} ${l.y})`}\n textAnchor=\"middle\"\n dominantBaseline=\"central\"\n fontSize={9}\n fontWeight={400}\n fill={c.label}\n >\n {l.text}\n </text>\n ))}\n {POIS.map((p) => (\n <g key={p.name} transform={`translate(${p.x} ${p.y})`}>\n <circle r={8.5} fill={c.poi} stroke={c.ground} strokeWidth={1.5} />\n <g transform=\"translate(-5.5 -5.5) scale(0.46)\">\n <path\n d={p.glyph}\n stroke=\"#fff\"\n strokeWidth={2.6}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </g>\n <text\n x={13}\n y={0}\n dominantBaseline=\"central\"\n fontSize={9.5}\n fontWeight={400}\n fill={c.label}\n stroke={c.ground}\n strokeWidth={3}\n paintOrder=\"stroke\"\n >\n {p.name}\n </text>\n </g>\n ))}\n </g>\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 30px 0 34px\",\n zIndex: 4,\n }}\n >\n <span\n style={{\n fontSize: 17,\n fontWeight: 400,\n color,\n letterSpacing: \"-0.01em\",\n width: 54,\n textAlign: \"center\",\n }}\n >\n 9:41\n </span>\n <div style={{ display: \"flex\", gap: 7, 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 <svg width=\"16\" height=\"12\" viewBox=\"0 0 16 12\">\n <path\n d=\"M8 11.2l2.3-2.6a3.3 3.3 0 00-4.6 0zM3.6 6.4a6.3 6.3 0 018.8 0l1.4-1.6a8.4 8.4 0 00-11.6 0zM.6 3.1a10.6 10.6 0 0114.8 0L16.8 1.5a12.7 12.7 0 00-17.6 0z\"\n fill={color}\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\nfunction Phone({ children, c }: { children: React.ReactNode; c: Palette }) {\n const btn = (side: \"left\" | \"right\", top: number, h: number) => (\n <div\n style={{\n position: \"absolute\",\n [side]: -2.5,\n top,\n width: 4,\n height: h,\n borderRadius: 2,\n background: c.frame,\n }}\n />\n );\n return (\n <div style={{ position: \"relative\", width: BW, height: BH }}>\n {btn(\"left\", 150, 32)}\n {btn(\"left\", 210, 62)}\n {btn(\"left\", 284, 62)}\n {btn(\"right\", 236, 98)}\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 66,\n background: c.frame,\n boxShadow: `${c.phoneShadow}, inset 0 0 0 1px rgba(255,255,255,0.22)`,\n }}\n />\n <div\n style={{\n position: \"absolute\",\n inset: 3.5,\n borderRadius: 62.5,\n background: \"#050506\",\n }}\n />\n <div\n style={{\n position: \"absolute\",\n left: BEZEL,\n top: BEZEL,\n width: SW,\n height: SH,\n borderRadius: 55,\n overflow: \"hidden\",\n background: c.sheet,\n }}\n >\n {children}\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: 9,\n }}\n />\n <div\n style={{\n position: \"absolute\",\n bottom: 8,\n left: (SW - 136) / 2,\n width: 136,\n height: 5,\n borderRadius: 3,\n background: c.text,\n zIndex: 9,\n }}\n />\n </div>\n </div>\n );\n}\n\nconst ICON = {\n back: \"M15 5l-7 7 7 7\",\n phone:\n \"M5 4h4l2 5-2.5 1.5a11 11 0 005 5L15 13l5 2v4a2 2 0 01-2 2A16 16 0 013 6a2 2 0 012-2\",\n shield: \"M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z\",\n share: \"M12 3v12M7 8l5-5 5 5M5 14v6h14v-6\",\n check: \"M5 12.5l4.5 4.5L19 7.5\",\n star: \"M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z\",\n};\n\nfunction Glyph({\n d,\n size = 18,\n color,\n}: {\n d: string;\n size?: number;\n color: string;\n}) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d={d}\n stroke={color}\n strokeWidth={1.75}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\n/** Driver photo stand-in: a soft portrait drawn in SVG. */\nfunction Portrait({ uid }: { uid: string }) {\n return (\n <svg\n width={52}\n height={52}\n viewBox=\"0 0 52 52\"\n style={{ display: \"block\" }}\n >\n <defs>\n <linearGradient id={`${uid}bg`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0\" stopColor=\"#c9d6e3\" />\n <stop offset=\"1\" stopColor=\"#9fb3c8\" />\n </linearGradient>\n <clipPath id={`${uid}av`}>\n <circle cx={26} cy={26} r={26} />\n </clipPath>\n </defs>\n <g clipPath={`url(#${uid}av)`}>\n <rect width={52} height={52} fill={`url(#${uid}bg)`} />\n <path d=\"M6 54c2-11 10-16 20-16s18 5 20 16z\" fill=\"#2f3a48\" />\n <path d=\"M21 33h10v7a5 5 0 01-10 0z\" fill=\"#b07a5a\" />\n <ellipse cx={26} cy={24} rx={9} ry={10.5} fill=\"#c68b67\" />\n <path\n d=\"M16.5 23c-.5-8 4-12.5 9.5-12.5S36 14 35.5 23c-1.5-4-4.5-6-9.5-6s-8 2-9.5 6z\"\n fill=\"#2a211c\"\n />\n </g>\n <circle cx={26} cy={26} r={25.5} fill=\"none\" stroke=\"rgba(0,0,0,0.08)\" />\n </svg>\n );\n}\n\n/** Side view of the car, as a ride app shows next to the plate. */\nfunction CarSide({ uid, dark }: { uid: string; dark: boolean }) {\n return (\n <svg width={58} height={26} viewBox=\"0 0 58 26\" style={{ flexShrink: 0 }}>\n <defs>\n <linearGradient id={`${uid}cs`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0\" stopColor={dark ? \"#8b9099\" : \"#a9aeb6\"} />\n <stop offset=\"1\" stopColor={dark ? \"#5d626b\" : \"#7c828c\"} />\n </linearGradient>\n </defs>\n <ellipse cx={29} cy={23.5} rx={26} ry={2} fill=\"rgba(0,0,0,0.12)\" />\n <path\n d=\"M3 18.5v-4c0-1.6 1-2.6 2.6-3l9-1.8 7-5.2c1-.7 2.1-1 3.3-1h12.2c1.5 0 2.8.6 3.8 1.7l4.6 5 5.8 1.2c1.6.3 2.7 1.6 2.7 3.2v3.9c0 1-.8 1.5-1.6 1.5H4.6c-.9 0-1.6-.6-1.6-1.5z\"\n fill={`url(#${uid}cs)`}\n />\n <path\n d=\"M17 10l6-4.6c.6-.5 1.4-.7 2.2-.7H30v5.3zM32.5 4.7h4.6c1 0 1.9.4 2.6 1.2l3.6 4.1H32.5z\"\n fill={dark ? \"#2a2e35\" : \"#3b4049\"}\n />\n {[14, 45].map((x) => (\n <g key={x}>\n <circle cx={x} cy={19.5} r={4.6} fill=\"#1d1f23\" />\n <circle cx={x} cy={19.5} r={2.2} fill=\"#9aa0a8\" />\n </g>\n ))}\n </svg>\n );\n}\n\nexport function RideTracking({\n driver = DEFAULT_DRIVER,\n eta = 4,\n pickup = \"214 Linden St\",\n accent = \"#276EF1\",\n speed = 1,\n theme = \"light\",\n lines = [\n \"Book it in one tap.\",\n \"Watch it come to you.\",\n \"Your ride is here.\",\n ],\n ground,\n groundParams,\n}: RideTrackingProps) {\n const frame = useCurrentFrame();\n const { fps, width, height } = useVideoConfig();\n const f = frame * speed;\n const dark = theme === \"dark\";\n const c = dark ? DARK : LIGHT;\n const uid = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n\n const tall = height > width;\n const W = tall ? 720 : 1280;\n const H = tall ? 1280 : 720;\n const u = Math.min(width / W, height / H);\n const k = tall ? (H * 0.72) / BH : (H * 0.94) / BH;\n const phoneCx = tall ? W / 2 : W * 0.68;\n const phoneCy = tall ? H - 30 - (BH * k) / 2 : H / 2;\n\n const sp = (at: number, config: Partial<typeof CARD> = CARD) =>\n spring({ frame: f - at, fps, config });\n const rise = sp(0, HEAVY);\n const camS = interpolate(f, [0, 270], [1, 1.03], clamp);\n\n const prog = (t: number) =>\n interpolate(t, [DRIVE_AT, DRIVE_END], [0, 1], { ...clamp, easing: MOVE });\n const d = prog(f);\n const s = d * ROUTE_LEN;\n const car = routePoint(s);\n const tan = routeTangent(s);\n const angle = (Math.atan2(tan.y, tan.x) * 180) / Math.PI + 90;\n const draw = interpolate(f, [DRAW_AT, DRAW_END], [0, 1], {\n ...clamp,\n easing: MOVE,\n });\n\n const lagged = [0, 4, 8, 12].map((lag) =>\n routePoint(prog(f - lag) * ROUTE_LEN),\n );\n const follow = {\n x: lagged.reduce((a, p) => a + p.x, 0) / lagged.length,\n y: lagged.reduce((a, p) => a + p.y, 0) / lagged.length,\n };\n const overview = { x: 505, y: 745 };\n const target = {\n x: follow.x + (PICKUP.x - follow.x) * 0.22,\n y: follow.y + (PICKUP.y - follow.y) * 0.22,\n };\n const m = interpolate(f, [DRAW_END - 6, DRIVE_AT + 30], [0, 1], {\n ...clamp,\n easing: CAMERA,\n });\n const arrive = spring({\n frame: f - DRIVE_END,\n fps,\n config: { damping: 200 },\n durationInFrames: 30,\n });\n const camX = overview.x + (target.x - overview.x) * m;\n const camY = overview.y + (target.y - overview.y) * m;\n const zoom = interpolate(m, [0, 1], [0.6, 0.98]) + arrive * 0.2;\n\n const stepAt = (n: number) => {\n for (let t = DRIVE_AT; t <= DRIVE_END; t++)\n if (prog(t) >= n / eta) return t;\n return DRIVE_END;\n };\n const steps = Array.from({ length: eta - 1 }, (_, i) => stepAt(i + 1));\n const roll = steps.reduce((a, at) => a + sp(at, CARD), 0);\n const etaLabels = Array.from({ length: eta - 1 }, (_, i) => `${eta - i}`);\n const arrived = f >= DRIVE_END;\n const arrivedIn = sp(DRIVE_END, CHIP);\n const swap = Math.min(1, sp(DRIVE_END, { damping: 200 }));\n const sheetIn = sp(10, CARD);\n const pinIn = sp(DRAW_END - 6, CHIP);\n const rows = [0, 1].map((i) => sp(18 + i * 4, CARD));\n\n const dash = `${Math.max(0.001, ROUTE_LEN * draw - s)} ${ROUTE_LEN * 3}`;\n const pulses = [0, 22, 44].map((off) => {\n const t = (((f - DRIVE_END - off) % 66) + 66) % 66;\n return f - DRIVE_END - off < 0 ? null : t / 66;\n });\n\n const row: React.CSSProperties = { display: \"flex\", alignItems: \"center\" };\n const pillX = FOCUS.x + (PICKUP.x - camX) * zoom;\n const rise8 = (v: number): React.CSSProperties => ({\n opacity: Math.min(1, v * 1.4),\n transform: `translateY(${(1 - v) * 16}px)`,\n });\n\n const beats = [0, DRIVE_AT - 4, DRIVE_END];\n const copyLine = (i: number) => {\n const inAt = beats[i] + (i === 0 ? 8 : 0);\n const outAt = beats[i + 1];\n const pin = interpolate(f, [inAt, inAt + 14], [0, 1], {\n ...clamp,\n easing: ENTER,\n });\n const pout =\n outAt === undefined\n ? 0\n : interpolate(f, [outAt - 2, outAt + 6], [0, 1], {\n ...clamp,\n easing: EXIT,\n });\n if (pin <= 0 || pout >= 1) return null;\n return (\n <div\n key={i}\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: 0,\n transform: `translateY(${(1 - pin) * 70 - pout * 50}%)`,\n opacity: pin * (1 - pout),\n }}\n >\n {lines[i]}\n </div>\n );\n };\n\n return (\n <AbsoluteFill style={{ fontFamily, overflow: \"hidden\" }}>\n <GshGround\n preset={ground ?? (dark ? \"earthshine\" : \"paper-crease\")}\n params={groundParams}\n timeOffset={dark ? 3 : 5}\n timeScale={0.35}\n />\n <AbsoluteFill style={{ background: c.scrim }} />\n <div\n style={{\n position: \"absolute\",\n left: (width - W * u) / 2,\n top: (height - H * u) / 2,\n width: W,\n height: H,\n transformOrigin: \"0 0\",\n transform: `scale(${u})`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: tall ? 56 : 88,\n top: tall ? 84 : H / 2 - 112,\n width: tall ? W - 112 : 470,\n height: tall ? 140 : 160,\n fontSize: tall ? 62 : 70,\n fontWeight: 300,\n lineHeight: 1.04,\n letterSpacing: \"-0.035em\",\n color: c.copy,\n overflow: \"hidden\",\n textWrap: \"balance\",\n }}\n >\n {[0, 1, 2].map((i) => copyLine(i))}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: tall ? 56 : 88,\n top: tall ? 236 : H / 2 + 72,\n fontSize: tall ? 26 : 22,\n fontWeight: 400,\n color: c.copyMuted,\n fontVariantNumeric: \"tabular-nums\",\n ...rise8(sp(20, CARD)),\n }}\n >\n {arrived ? `${driver.name} · ${driver.plate}` : `Pickup at ${pickup}`}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: phoneCx - BW / 2,\n top: phoneCy - BH / 2,\n width: BW,\n height: BH,\n transform: `translateY(${(1 - rise) * H * 0.9}px) scale(${k * camS})`,\n }}\n >\n <Phone c={c}>\n <svg\n width={SW}\n height={SH}\n style={{ position: \"absolute\", inset: 0 }}\n fontFamily={fontFamily}\n >\n <defs>\n <filter\n id={`${uid}sh`}\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n >\n <feDropShadow\n dx=\"0\"\n dy=\"2\"\n stdDeviation=\"2.2\"\n floodOpacity=\"0.4\"\n />\n </filter>\n <linearGradient id={`${uid}car`} x1=\"0\" x2=\"1\" y1=\"0\" y2=\"0\">\n <stop offset=\"0\" stopColor={c.carShade} />\n <stop offset=\"0.3\" stopColor={c.carBody} />\n <stop offset=\"0.7\" stopColor={c.carBody} />\n <stop offset=\"1\" stopColor={c.carShade} />\n </linearGradient>\n </defs>\n <g\n transform={`translate(${FOCUS.x} ${FOCUS.y}) scale(${zoom}) translate(${-camX} ${-camY})`}\n >\n <MapArt c={c} />\n <path\n d={ROUTE}\n stroke={c.casing}\n strokeWidth={11}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeDasharray={dash}\n strokeDashoffset={-s}\n />\n <path\n d={ROUTE}\n stroke={c.route}\n strokeWidth={6}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeDasharray={dash}\n strokeDashoffset={-s}\n />\n {pulses.map((p, i) =>\n p === null ? null : (\n <circle\n key={i}\n cx={PICKUP.x}\n cy={PICKUP.y}\n r={8 + p * 46}\n fill={accent}\n opacity={(1 - p) * 0.3}\n />\n ),\n )}\n <g\n transform={`translate(${PICKUP.x} ${PICKUP.y}) scale(${pinIn})`}\n >\n <line\n x1={0}\n y1={0}\n x2={0}\n y2={-24}\n stroke={accent}\n strokeWidth={2.5}\n />\n <circle r={8} fill={accent} stroke=\"#fff\" strokeWidth={2.5} />\n <rect x={-2.5} y={-2.5} width={5} height={5} fill=\"#fff\" />\n </g>\n <g\n transform={`translate(${RIDER.x} ${RIDER.y})`}\n opacity={Math.min(1, pinIn)}\n >\n {[0, 1, 2].map((i) => (\n <circle\n key={i}\n cx={(PICKUP.x - RIDER.x) * (0.25 + i * 0.25)}\n cy={(PICKUP.y + 6 - RIDER.y) * (0.25 + i * 0.25)}\n r={1.6}\n fill={c.label}\n />\n ))}\n <circle r={16} fill={accent} opacity={0.14} />\n <circle\n r={6.5}\n fill={accent}\n stroke=\"#fff\"\n strokeWidth={2.5}\n />\n </g>\n <g\n transform={`translate(${car.x} ${car.y}) rotate(${angle}) scale(1.35)`}\n filter={`url(#${uid}sh)`}\n >\n <path\n d=\"M -7.5 -14 Q -7.5 -17 -4 -17.5 L 4 -17.5 Q 7.5 -17 7.5 -14 L 8 13 Q 8 17 4 17.5 L -4 17.5 Q -8 17 -8 13 Z\"\n fill={`url(#${uid}car)`}\n stroke={c.carShade}\n strokeWidth={0.6}\n />\n <path\n d=\"M -6 -7.5 Q 0 -10 6 -7.5 L 5 -3 L -5 -3 Z\"\n fill={c.glass}\n />\n <path\n d=\"M -5 9 L 5 9 L 5.6 12.5 Q 0 14 -5.6 12.5 Z\"\n fill={c.glass}\n />\n <rect\n x={-5}\n y={-3}\n width={10}\n height={12}\n rx={2}\n fill={c.carBody}\n />\n </g>\n </g>\n </svg>\n <div\n style={{\n position: \"absolute\",\n left: pillX,\n top:\n FOCUS.y + (PICKUP.y - camY) * zoom - 24 * zoom * pinIn - 38,\n transform: `translateX(-50%) scale(${pinIn})`,\n transformOrigin: \"50% 100%\",\n opacity: interpolate(\n Math.min(pillX, SW - pillX),\n [40, 110],\n [0, 1],\n clamp,\n ),\n padding: \"8px 13px\",\n borderRadius: 12,\n background: c.sheet,\n color: c.text,\n fontSize: 14,\n fontWeight: 400,\n whiteSpace: \"nowrap\",\n boxShadow: dark\n ? \"0 0 0 1px rgba(255,255,255,0.1), 0 8px 20px rgba(0,0,0,0.4)\"\n : \"0 0 0 1px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.08), 0 8px 18px -6px rgba(0,0,0,0.18)\",\n zIndex: 3,\n ...row,\n gap: 7,\n }}\n >\n <div\n style={{\n width: 7,\n height: 7,\n borderRadius: 4,\n background: accent,\n }}\n />\n {arrived ? \"Driver is here\" : pickup}\n </div>\n <div\n style={{\n position: \"absolute\",\n inset: \"0 0 auto 0\",\n height: 120,\n background: `linear-gradient(180deg, ${dark ? \"rgba(0,0,0,0.55)\" : \"rgba(255,255,255,0.75)\"}, transparent)`,\n zIndex: 3,\n }}\n />\n <StatusBar color={c.status} />\n <div\n style={{\n position: \"absolute\",\n top: 62,\n left: 18,\n width: 44,\n height: 44,\n borderRadius: 22,\n background: c.sheet,\n boxShadow: dark\n ? \"0 0 0 1px rgba(255,255,255,0.08)\"\n : \"0 0 0 1px rgba(0,0,0,0.05), 0 4px 12px -4px rgba(0,0,0,0.2)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n zIndex: 4,\n }}\n >\n <Glyph d={ICON.back} size={20} color={c.text} />\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: SHEET_Y,\n bottom: 0,\n background: c.sheet,\n borderRadius: \"28px 28px 0 0\",\n boxShadow: dark\n ? \"0 0 0 1px rgba(255,255,255,0.07)\"\n : \"0 -1px 0 rgba(0,0,0,0.04), 0 -12px 32px -8px rgba(0,0,0,0.14)\",\n transform: `translateY(${(1 - sheetIn) * 340}px)`,\n padding: \"8px 20px 0\",\n boxSizing: \"border-box\",\n color: c.text,\n zIndex: 5,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n <div\n style={{\n width: 36,\n height: 5,\n borderRadius: 3,\n background: c.hair,\n margin: \"0 auto 16px\",\n }}\n />\n <div style={{ ...row, justifyContent: \"space-between\", gap: 12 }}>\n <div style={{ position: \"relative\", flex: 1, height: 52 }}>\n {[false, true].map((isArr) => (\n <div\n key={String(isArr)}\n style={{\n position: \"absolute\",\n inset: 0,\n opacity: isArr ? swap : 1 - swap,\n transform: `translateY(${isArr ? (1 - swap) * 10 : -swap * 8}px)`,\n }}\n >\n <div\n style={{\n fontSize: 23,\n fontWeight: 400,\n letterSpacing: \"-0.02em\",\n whiteSpace: \"nowrap\",\n }}\n >\n {isArr\n ? \"Your driver has arrived\"\n : `${driver.name} is on the way`}\n </div>\n <div\n style={{ fontSize: 15, color: c.muted, marginTop: 4 }}\n >\n {isArr\n ? `Meet ${driver.name} at the pin`\n : `Arriving at ${pickup}`}\n </div>\n </div>\n ))}\n </div>\n <div\n style={{\n position: \"relative\",\n width: 64,\n height: 52,\n borderRadius: 14,\n background: c.chip,\n overflow: \"hidden\",\n flexShrink: 0,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n opacity: 1 - swap,\n maskImage:\n \"linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent)\",\n }}\n >\n <div style={{ transform: `translateY(${-roll * 52}px)` }}>\n {[...etaLabels, \"1\"].map((l, i) => (\n <div\n key={`${l}${i}`}\n style={{\n height: 52,\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <div\n style={{\n fontSize: 22,\n fontWeight: 400,\n lineHeight: \"24px\",\n }}\n >\n {l}\n </div>\n <div style={{ fontSize: 12, color: c.muted }}>\n min\n </div>\n </div>\n ))}\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n background: accent,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: arrived ? Math.min(1, arrivedIn * 1.6) : 0,\n }}\n >\n <div\n style={{ transform: `scale(${0.5 + arrivedIn * 0.5})` }}\n >\n <Glyph d={ICON.check} size={26} color=\"#fff\" />\n </div>\n </div>\n </div>\n </div>\n <div\n style={{\n height: 4,\n borderRadius: 2,\n background: c.chip,\n marginTop: 16,\n overflow: \"hidden\",\n }}\n >\n <div\n style={{\n width: \"100%\",\n height: 4,\n borderRadius: 2,\n background: arrived ? accent : c.text,\n transform: `scaleX(${0.06 + d * 0.94})`,\n transformOrigin: \"0 50%\",\n }}\n />\n </div>\n <div\n style={{\n height: 1,\n background: c.line,\n margin: \"20px -20px 16px\",\n }}\n />\n <div style={{ ...row, gap: 12, ...rise8(rows[0]) }}>\n <div style={{ flexShrink: 0 }}>\n <Portrait uid={uid} />\n </div>\n <div style={{ flex: 1, minWidth: 0 }}>\n <div\n style={{\n ...row,\n gap: 8,\n fontSize: 17,\n fontWeight: 400,\n whiteSpace: \"nowrap\",\n }}\n >\n {driver.name}\n <span\n style={{\n ...row,\n gap: 3,\n fontSize: 13,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n <svg\n width={11}\n height={11}\n viewBox=\"0 0 24 24\"\n style={{ flexShrink: 0 }}\n >\n <path d={ICON.star} fill={c.text} />\n </svg>\n {driver.rating.toFixed(2)}\n </span>\n </div>\n <div style={{ fontSize: 13, color: c.muted, marginTop: 2 }}>\n {driver.trips}\n </div>\n </div>\n <CarSide uid={uid} dark={dark} />\n <div style={{ textAlign: \"right\", flexShrink: 0 }}>\n <div\n style={{\n display: \"inline-block\",\n padding: \"3px 8px\",\n borderRadius: 6,\n background: c.chip,\n fontSize: 15,\n fontWeight: 400,\n letterSpacing: \"0.04em\",\n }}\n >\n {driver.plate}\n </div>\n <div style={{ fontSize: 12, color: c.muted, marginTop: 4 }}>\n {driver.car}\n </div>\n </div>\n </div>\n <div\n style={{ ...row, gap: 10, marginTop: 22, ...rise8(rows[1]) }}\n >\n <div\n style={{\n flex: 1,\n height: 46,\n borderRadius: 23,\n background: c.chip,\n ...row,\n padding: \"0 18px\",\n fontSize: 15,\n color: c.muted,\n }}\n >\n Message {driver.name}\n </div>\n {[ICON.phone, ICON.shield].map((ic) => (\n <div\n key={ic}\n style={{\n width: 46,\n height: 46,\n borderRadius: 23,\n background: c.chip,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <Glyph d={ic} size={19} color={c.text} />\n </div>\n ))}\n </div>\n </div>\n </Phone>\n </div>\n </div>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/ride-tracking.tsx"
}
],
"type": "registry:component"
}