{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"quadrant-plot","type":"registry:component","title":"Quadrant Plot","description":"Competitors scatter on a quadrant plot and the Kuchi marker lands in the best corner.","dependencies":["remotion","@remotion/google-fonts"],"docs":"Needs a Remotion project. If a frame renders black, the component is drawing on a transparent layer: put a background behind it, e.g. <AbsoluteFill style={{ background: \"#faf9f6\" }}><Component /></AbsoluteFill>.","files":[{"path":"components/kuchi/quadrant-plot.tsx","type":"registry:component","target":"components/kuchi/quadrant-plot.tsx","content":"/*! Portions Copyright (c) 2026 Remocn. MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\n\nimport { loadFont as loadGeist } from \"@remotion/google-fonts/Geist\";\nimport { loadFont as loadGeistMono } from \"@remotion/google-fonts/GeistMono\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport type React from \"react\";\nimport { useId } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  interpolateColors,\n  spring,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst { fontFamily: sans } = loadGeist(\"normal\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\nconst { fontFamily: mono } = loadGeistMono(\"normal\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\nconst { fontFamily: manrope } = loadManrope(\"normal\", {\n  weights: [\"600\"],\n  subsets: [\"latin\"],\n});\n\nexport interface QuadrantPoint {\n  label: string;\n  x: number;\n  y: number;\n}\n\nexport interface QuadrantPlotProps {\n  xLabels?: [string, string];\n  yLabels?: [string, string];\n  points?: QuadrantPoint[];\n  brand?: QuadrantPoint;\n  accent?: string;\n  /** Color of the brand label and the lit axis ends; overrides the theme. */\n  ink?: string;\n  /** Background fill; \"transparent\" drops it. */\n  background?: string;\n  /** Typeface for the point and brand labels. Load it yourself; Geist by default. */\n  fontFamily?: string;\n  /** Frames between competitor dots dropping in. */\n  stagger?: number;\n  /** Replaces the acme mark when the brand label is \"acme\". */\n  logo?: React.ReactNode;\n  /** Film grain over the scene. */\n  grain?: boolean;\n  /** Size of the plot, around the frame's center. */\n  scale?: number;\n  /** Frames to hold the first frame before anything moves. */\n  delay?: number;\n  theme?: \"dark\" | \"light\";\n  speed?: number;\n}\n\nconst DEFAULT_POINTS: QuadrantPoint[] = [\n  { label: \"Kitebase\", x: 0.71, y: 0.3 },\n  { label: \"Lumen\", x: 0.27, y: 0.71 },\n  { label: \"Fernway\", x: 0.2, y: 0.24 },\n  { label: \"Quarry\", x: 0.6, y: 0.4 },\n  { label: \"Orbitly\", x: 0.38, y: 0.58 },\n  { label: \"Halcyon\", x: 0.13, y: 0.42 },\n];\n\nconst DEFAULT_BRAND: QuadrantPoint = { label: \"acme\", x: 0.74, y: 0.8 };\n\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_ARRIVE = Easing.bezier(0.2, 0.9, 0.25, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\nconst THEMES = {\n  dark: {\n    bg: \"#0A0A0B\",\n    fg: \"#F3F2EF\",\n    muted: \"#8B8A90\",\n    axis: \"rgba(255,255,255,0.26)\",\n    mark: \"rgba(255,255,255,0.32)\",\n    grid: \"rgba(255,255,255,0.075)\",\n    dot: \"#9C9BA1\",\n    grain: 0.06,\n    hero: \"#F5F6FF\",\n    heroLabel: \"#F5F6FF\",\n    guide: \"rgba(245,246,255,0.55)\",\n    // gradients.sh \"mesh\": bg #0a0d24, [#ecdcf2, #8796ee, #2e45b7, #0e1645]\n    meshBg: \"#0a0d24\",\n    blobs: [\n      [\"#2e45b7\", 18, 6, 0.95],\n      [\"#ecdcf2\", -2, 112, 0.8],\n      [\"#8796ee\", 30, 84, 0.85],\n      [\"#2e45b7\", 72, 46, 1],\n      [\"#0e1645\", 102, 104, 1],\n      [\"#8796ee\", 104, -6, 0.45],\n    ],\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    fg: \"#121214\",\n    muted: \"#6E6C67\",\n    axis: \"rgba(18,18,20,0.26)\",\n    mark: \"rgba(18,18,20,0.32)\",\n    grid: \"rgba(18,18,20,0.08)\",\n    dot: \"#8E8C86\",\n    grain: 0.045,\n    hero: \"#121214\",\n    heroLabel: \"#121214\",\n    guide: \"rgba(18,18,20,0.45)\",\n    meshBg: \"#EEF0FB\",\n    blobs: [\n      [\"#8796ee\", 0, 104, 0.95],\n      [\"#ecdcf2\", 36, 70, 1],\n      [\"#2e45b7\", 8, 40, 0.45],\n      [\"#8796ee\", 100, 0, 0.55],\n      [\"#ecdcf2\", 96, 96, 0.9],\n      [\"#2e45b7\", 104, 104, 0.35],\n    ],\n  },\n} as const;\n\nconst AXIS = [-8, 22] as const;\nconst DROP = 26;\nconst DROP_STAGGER = 4;\nconst ARRIVE = 62;\nconst ARRIVE_LEN = 30;\nconst LANDED = ARRIVE + ARRIVE_LEN - 8;\n\nfunction Grain({ opacity }: { opacity: number }) {\n  const id = `g${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n  return (\n    <svg\n      width=\"100%\"\n      height=\"100%\"\n      style={{ position: \"absolute\", inset: 0, opacity }}\n      aria-hidden\n    >\n      <filter id={id}>\n        <feTurbulence\n          type=\"fractalNoise\"\n          baseFrequency=\"0.9\"\n          numOctaves={2}\n          seed={23}\n          stitchTiles=\"stitch\"\n        />\n        <feColorMatrix values=\"0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0.9 0\" />\n      </filter>\n      <rect width=\"100%\" height=\"100%\" filter={`url(#${id})`} />\n    </svg>\n  );\n}\n\n\n/** The acme.dev logo: R mark (0.76em, on the baseline) + \"Acme\" in Manrope 600. */\nfunction KuchiLogo({ fontSize, color }: { fontSize: number; color: string }) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        alignItems: \"baseline\",\n        color,\n        fontFamily: manrope,\n        fontWeight: 600,\n        fontSize,\n        letterSpacing: \"-0.025em\",\n        lineHeight: 1,\n        whiteSpace: \"nowrap\",\n      }}\n    >\n      <span>Acme</span>\n    </div>\n  );\n}\n\nconst clamp01 = (v: number) => Math.min(1, Math.max(0, v));\n\n/** The foreground at `scale`, around the frame's center; nothing extra at 1. */\nfunction ScaleLayer({\n  scale,\n  children,\n}: {\n  scale: number;\n  children: React.ReactNode;\n}) {\n  if (scale === 1) return children;\n  return (\n    <AbsoluteFill style={{ transform: `scale(${scale})` }}>\n      {children}\n    </AbsoluteFill>\n  );\n}\n\nexport function QuadrantPlot({\n  xLabels = [\"Slow\", \"Fast\"],\n  yLabels = [\"Hard\", \"Easy\"],\n  points = DEFAULT_POINTS,\n  brand = DEFAULT_BRAND,\n  accent = \"#3B5BFD\",\n  ink,\n  background,\n  fontFamily = sans,\n  stagger = DROP_STAGGER,\n  logo,\n  grain = true,\n  scale = 1,\n  delay = 0,\n  theme = \"dark\",\n  speed = 1,\n}: QuadrantPlotProps) {\n  const t = Math.max(0, useCurrentFrame() - delay) * speed;\n  const { width, height, fps } = useVideoConfig();\n  const u = Math.min(width / 1280, height / 720);\n  const p = THEMES[theme];\n  const fg = ink ?? p.fg;\n  const heroLabel = ink ?? p.heroLabel;\n  const stage =\n    background === \"transparent\" ? \"transparent\" : (background ?? p.bg);\n\n  const cx = width / 2;\n  const cy = height / 2;\n  const hw = width * 0.3;\n  const hh = height * 0.3;\n  const toX = (x: number) => cx + (clamp01(x) - 0.5) * 2 * hw;\n  const toY = (y: number) => cy - (clamp01(y) - 0.5) * 2 * hh;\n  const sw = Math.max(1, u);\n\n  const axisK = interpolate(t, AXIS, [0, 1], { ...CLAMP, easing: EASE_IO });\n  const markK = interpolate(t, [12, 30], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n  const labelK = (delay: number) =>\n    interpolate(t, [14 + delay, 32 + delay], [0, 1], {\n      ...CLAMP,\n      easing: EASE_OUT,\n    });\n\n  const arrive = interpolate(t, [ARRIVE, ARRIVE + ARRIVE_LEN], [0, 1], {\n    ...CLAMP,\n    easing: EASE_ARRIVE,\n  });\n  const bx = toX(brand.x);\n  const by = toY(brand.y);\n  const sx = cx - hw * 0.12;\n  const sy = cy + hh * 0.18;\n  const qx = bx + hw * 0.05;\n  const qy = sy - hh * 0.05;\n  const along = (k: number): [number, number] => {\n    const a = (1 - k) * (1 - k);\n    const b = 2 * (1 - k) * k;\n    const c = k * k;\n    return [a * sx + b * qx + c * bx, a * sy + b * qy + c * by];\n  };\n  const arriveAt = (time: number) =>\n    interpolate(time, [ARRIVE, ARRIVE + ARRIVE_LEN], [0, 1], {\n      ...CLAMP,\n      easing: EASE_ARRIVE,\n    });\n  const [dx, dy] = along(arrive);\n  const brandO = interpolate(t, [ARRIVE, ARRIVE + 5], [0, 1], CLAMP);\n  const brandS = interpolate(t, [ARRIVE, ARRIVE + 10], [0.6, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n  const ghosts = [1.5, 3, 4.5].map((lag, i) => {\n    const [gx, gy] = along(arriveAt(t - lag));\n    const dist = Math.hypot(gx - dx, gy - dy);\n    return {\n      gx,\n      gy,\n      o: Math.min(1, dist / (18 * u)) * [0.3, 0.16, 0.08][i] * brandO,\n    };\n  });\n\n  const ring = interpolate(t, [LANDED, LANDED + 26], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n  const dim = interpolate(t, [LANDED - 4, LANDED + 14], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const wash = interpolate(t, [LANDED - 2, LANDED + 20], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const guide = interpolate(t, [LANDED + 4, LANDED + 22], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const brandLab = interpolate(t, [LANDED - 2, LANDED + 16], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n\n  const push = interpolate(t, [0, 140], [0, 1], { ...CLAMP, easing: EASE_IO });\n  const zoom = 0.975 + 0.04 * push;\n  const drift = interpolate(t, [ARRIVE - 10, 140], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const camX = -(bx - cx) * 0.035 * drift;\n  const camY = -(by - cy) * 0.035 * drift;\n\n  const corner = 16 * u * markK;\n  const corners: Array<[number, number, number, number]> = [\n    [cx - hw, cy - hh, 1, 1],\n    [cx + hw, cy - hh, -1, 1],\n    [cx - hw, cy + hh, 1, -1],\n    [cx + hw, cy + hh, -1, -1],\n  ];\n\n  const gap = 0.25;\n  const gridDots: Array<[number, number]> = [];\n  for (let gx = 0; gx <= 1.0001; gx += gap / 2) {\n    for (let gy = 0; gy <= 1.0001; gy += gap / 2) {\n      if (Math.abs(gx - 0.5) < 0.01 || Math.abs(gy - 0.5) < 0.01) continue;\n      gridDots.push([toX(gx), toY(gy)]);\n    }\n  }\n\n  const endLabel = (\n    text: string,\n    x: number,\n    y: number,\n    align: \"left\" | \"right\" | \"top\" | \"bottom\",\n    k: number,\n    strong: boolean,\n  ) => {\n    const tx = align === \"left\" ? \"-100%\" : align === \"right\" ? \"0%\" : \"-50%\";\n    const ty = align === \"top\" ? \"-100%\" : align === \"bottom\" ? \"0%\" : \"-50%\";\n    const nudge = (1 - k) * 10 * u;\n    const ox = align === \"left\" ? nudge : align === \"right\" ? -nudge : 0;\n    const oy = align === \"top\" ? nudge : align === \"bottom\" ? -nudge : 0;\n    return (\n      <div\n        key={text + align}\n        style={{\n          position: \"absolute\",\n          left: x,\n          top: y,\n          transform: `translate(${tx}, ${ty}) translate(${ox}px, ${oy}px)`,\n          fontFamily: mono,\n          fontWeight: 400,\n          fontSize: 14 * u,\n          letterSpacing: \"0.12em\",\n          textTransform: \"uppercase\",\n          color: strong\n            ? interpolateColors(wash, [0, 1], [p.muted, fg])\n            : p.muted,\n          opacity: k,\n          whiteSpace: \"nowrap\",\n        }}\n      >\n        {text}\n      </div>\n    );\n  };\n\n  const pad = 20 * u;\n  const reveal = 0.25 + 0.75 * wash;\n  const sway = interpolate(t, [LANDED - 4, 140], [0, 1], CLAMP);\n  const mesh = [\n    ...p.blobs.map(\n      ([c, x, y, a], i) =>\n        `radial-gradient(85% 95% at ${x + Math.sin(i * 1.7 + sway * 1.4) * 4}% ${y + Math.cos(i * 2.3 + sway * 1.2) * 4}%, color-mix(in oklab, ${c} ${Math.round(a * 100)}%, transparent) 0%, transparent 68%)`,\n    ),\n    `linear-gradient(${p.meshBg}, ${p.meshBg})`,\n  ].join(\", \");\n  const heroDot =\n    theme === \"light\"\n      ? accent\n      : interpolateColors(wash, [0, 1], [accent, p.hero]);\n\n  return (\n    <AbsoluteFill style={{ background: stage, overflow: \"hidden\" }}>\n      <ScaleLayer scale={scale}>\n        <AbsoluteFill\n          style={{\n            transform: `translate(${camX}px, ${camY}px) scale(${zoom})`,\n            transformOrigin: \"50% 50%\",\n          }}\n        >\n          <div\n            style={{\n              position: \"absolute\",\n              left: cx,\n              top: cy - hh,\n              width: hw,\n              height: hh,\n              background: mesh,\n              opacity: wash,\n              clipPath: `inset(${(1 - reveal) * 100}% ${(1 - reveal) * 100}% 0 0)`,\n            }}\n          />\n          <svg\n            width={width}\n            height={height}\n            style={{ position: \"absolute\", inset: 0 }}\n            aria-hidden\n          >\n            {gridDots.map(([gx, gy]) => (\n              <circle\n                key={`${gx.toFixed(1)}-${gy.toFixed(1)}`}\n                cx={gx}\n                cy={gy}\n                r={1.3 * u}\n                fill={p.grid}\n                opacity={markK}\n              />\n            ))}\n\n            <line\n              x1={cx - hw * axisK}\n              y1={cy}\n              x2={cx + hw * axisK}\n              y2={cy}\n              stroke={p.axis}\n              strokeWidth={sw}\n            />\n            <line\n              x1={cx}\n              y1={cy - hh * axisK}\n              x2={cx}\n              y2={cy + hh * axisK}\n              stroke={p.axis}\n              strokeWidth={sw}\n            />\n\n            {corners.map(([x, y, ix, iy]) => (\n              <path\n                key={`${x}-${y}`}\n                d={`M${x + ix * corner} ${y} L${x} ${y} L${x} ${y + iy * corner}`}\n                fill=\"none\"\n                stroke={p.mark}\n                strokeWidth={sw}\n                opacity={markK * (ix < 0 && iy > 0 ? 1 - wash : 1)}\n              />\n            ))}\n\n            {points.map((pt, i) => {\n              const start = DROP + i * stagger;\n              const s = spring({\n                frame: t - start,\n                fps,\n                config: { damping: 14, stiffness: 170, mass: 0.7 },\n              });\n              const o = interpolate(t, [start, start + 6], [0, 1], CLAMP);\n              const x = toX(pt.x);\n              const y = toY(pt.y) - (1 - s) * 34 * u;\n              return (\n                <circle\n                  key={pt.label}\n                  cx={x}\n                  cy={y}\n                  r={7 * u}\n                  fill={p.dot}\n                  opacity={o * (1 - 0.62 * dim)}\n                />\n              );\n            })}\n\n            <g opacity={guide * 0.9}>\n              <line\n                x1={bx}\n                y1={by}\n                x2={bx}\n                y2={by + (cy - by) * guide}\n                stroke={p.guide}\n                strokeWidth={sw}\n                strokeDasharray={`${3 * u} ${5 * u}`}\n              />\n              <line\n                x1={bx}\n                y1={by}\n                x2={bx + (cx - bx) * guide}\n                y2={by}\n                stroke={p.guide}\n                strokeWidth={sw}\n                strokeDasharray={`${3 * u} ${5 * u}`}\n              />\n            </g>\n\n            {ghosts.map((g, i) => (\n              <circle\n                key={i}\n                cx={g.gx}\n                cy={g.gy}\n                r={12 * u * brandS}\n                fill={accent}\n                opacity={t >= ARRIVE ? g.o : 0}\n              />\n            ))}\n            <circle\n              cx={dx}\n              cy={dy}\n              r={(12 + 36 * ring) * u}\n              fill=\"none\"\n              stroke={heroDot}\n              strokeWidth={1.5 * u}\n              opacity={t >= LANDED ? (1 - ring) * 0.7 : 0}\n            />\n            <circle\n              cx={dx}\n              cy={dy}\n              r={22 * u}\n              fill=\"none\"\n              stroke={heroDot}\n              strokeWidth={sw}\n              opacity={brandLab * 0.45}\n            />\n            <circle\n              cx={dx}\n              cy={dy}\n              r={12 * u * brandS}\n              fill={heroDot}\n              opacity={t >= ARRIVE ? brandO : 0}\n            />\n          </svg>\n\n          {points.map((pt, i) => {\n            const start = DROP + i * stagger + 5;\n            const k = interpolate(t, [start, start + 14], [0, 1], {\n              ...CLAMP,\n              easing: EASE_OUT,\n            });\n            return (\n              <div\n                key={pt.label}\n                style={{\n                  position: \"absolute\",\n                  left: toX(pt.x) + 15 * u,\n                  top: toY(pt.y),\n                  transform: `translate(${(1 - k) * -6 * u}px, -50%)`,\n                  fontFamily,\n                  fontWeight: 400,\n                  fontSize: 17 * u,\n                  letterSpacing: \"-0.005em\",\n                  color: p.muted,\n                  opacity: k * (1 - 0.6 * dim),\n                  whiteSpace: \"nowrap\",\n                }}\n              >\n                {pt.label}\n              </div>\n            );\n          })}\n\n          <div\n            style={{\n              position: \"absolute\",\n              left: bx + 36 * u,\n              top: by,\n              transform: `translate(${(1 - brandLab) * -10 * u}px, -50%)`,\n              opacity: brandLab,\n            }}\n          >\n            {brand.label.toLowerCase() === \"acme\" ? (\n              (logo ?? <KuchiLogo fontSize={34 * u} color={heroLabel} />)\n            ) : (\n              <div\n                style={{\n                  fontFamily,\n                  fontWeight: 500,\n                  fontSize: 32 * u,\n                  letterSpacing: \"-0.025em\",\n                  color: heroLabel,\n                  whiteSpace: \"nowrap\",\n                }}\n              >\n                {brand.label}\n              </div>\n            )}\n          </div>\n\n          {endLabel(xLabels[0], cx - hw - pad, cy, \"left\", labelK(0), false)}\n          {endLabel(xLabels[1], cx + hw + pad, cy, \"right\", labelK(2), true)}\n          {endLabel(yLabels[1], cx, cy - hh - pad, \"top\", labelK(4), true)}\n          {endLabel(yLabels[0], cx, cy + hh + pad, \"bottom\", labelK(6), false)}\n        </AbsoluteFill>\n      </ScaleLayer>\n\n      <AbsoluteFill\n        style={{\n          background: `radial-gradient(ellipse 80% 80% at 50% 50%, transparent 62%, ${stage} 100%)`,\n          opacity: 0.6,\n        }}\n      />\n      {grain ? <Grain opacity={p.grain} /> : null}\n    </AbsoluteFill>\n  );\n}\n"}]}