{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "combo-counter",
  "title": "Combo Counter",
  "description": "A gradient hit counter climbs to '12 HIT COMBO' with rating words like 'PERFECT'.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "files": [
    {
      "path": "registry/remocn/combo-counter/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport { loadFont } from \"@remotion/google-fonts/Saira\";\nimport { useId } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst { fontFamily: sairaItalic } = loadFont(\"italic\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\nconst { fontFamily: saira } = loadFont(\"normal\", {\n  weights: [\"500\"],\n  subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n  weights: [\"600\"],\n  subsets: [\"latin\"],\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\n/** Full logo as on remocn.dev: R mark (0.76em tall, baseline-aligned) + \"emocn\" in Manrope 600. */\nfunction RemocnLogo({ fontSize, color }: { fontSize: number; color: string }) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        alignItems: \"baseline\",\n        color,\n        fontFamily: manrope.fontFamily,\n        fontWeight: 600,\n        fontSize,\n        letterSpacing: \"-0.025em\",\n        lineHeight: 1,\n      }}\n    >\n      <svg\n        viewBox=\"0 0 124.06 134.26\"\n        style={{ height: \"0.76em\", width: \"auto\" }}\n        aria-hidden\n      >\n        <path fill=\"currentColor\" d={REMOCN_R_PATH} />\n      </svg>\n      <span style={{ marginLeft: \"0.04em\" }}>emocn</span>\n    </div>\n  );\n}\n\nexport interface ComboRating {\n  /** The hit count this rating kicks in at. */\n  from: number;\n  text: string;\n}\n\nexport interface ComboCounterProps {\n  /** One hit per feature, in order. The combo count is the number of hits landed. */\n  hits?: string[];\n  /** Ratings, swapped in as the count passes `from`. The last one is the poster's. */\n  ratings?: ComboRating[];\n  /** Small marker next to the rating. */\n  accent?: string;\n  theme?: \"dark\" | \"light\";\n  speed?: number;\n}\n\n// Beat sheet (30fps, speed 1):\n//   6–66   twelve feature names hit one after another, the gaps shrinking from\n//          8 frames to 4; each lands as a hit-spark (star flash + gradient\n//          slash + the word slamming in from 1.4×) and fades after ~10 frames\n//  14–66  the combo meter on the left counts from 2 up, every hit scales and\n//          shakes it a bit harder; the rating swaps Nice → Great → PERFECT\n//  66     finisher: the 12th hit, the frame flashes, PERFECT slams in\n//  72–86  the meter glides to the centre and scales up into the poster, the\n//          number fills with the \"swirl\" gradient\n//  92–    the logo rises in, poster hold\nconst HIT_GAPS = [8, 7, 7, 6, 6, 5, 5, 4, 4, 4, 4];\nconst FIRST_HIT = 6;\nconst WORD_LIFE = 11;\nconst GLIDE_DELAY = 6;\nconst GLIDE_LEN = 14;\nconst FILL_DELAY = 10;\nconst FILL_LEN = 10;\nconst LOGO_DELAY = 26;\n\nconst SLAM = Easing.bezier(0.12, 0.9, 0.25, 1);\nconst OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst INOUT = Easing.bezier(0.65, 0, 0.25, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\n// gradients.sh \"swirl\": bg #07060a, [#ffe2c4, #ff9a4d, #d2456b, #3a1f6b].\nconst SWIRL = [\"#FFE2C4\", \"#FF9A4D\", \"#D2456B\", \"#3A1F6B\"] as const;\n\nconst THEMES = {\n  dark: {\n    stage: \"#08070B\",\n    ink: \"#F3F2EF\",\n    dim: \"#8A8990\",\n    flash: \"#FFFFFF\",\n    number: `linear-gradient(170deg, ${SWIRL[0]} 6%, ${SWIRL[1]} 38%, ${SWIRL[2]} 72%, #8E3A9E 100%)`,\n  },\n  light: {\n    stage: \"#F5F4F0\",\n    ink: \"#121214\",\n    dim: \"#7E7D77\",\n    flash: \"#FFFFFF\",\n    number: `linear-gradient(170deg, ${SWIRL[1]} 4%, ${SWIRL[2]} 50%, ${SWIRL[3]} 100%)`,\n  },\n} as const;\n\n// Where each hit lands, centre of the word, in units of W and H.\nconst SLOTS = [\n  { x: 0.67, y: 0.3, r: -4 },\n  { x: 0.79, y: 0.54, r: 3 },\n  { x: 0.63, y: 0.74, r: -2 },\n  { x: 0.8, y: 0.22, r: 4 },\n  { x: 0.66, y: 0.5, r: -3 },\n  { x: 0.78, y: 0.8, r: 2 },\n];\n\n// Long hit-slashes that stay behind the poster.\nconst POSTER_SLASHES = [\n  { dx: -0.06, dy: 0, len: 0.42, thick: 9, delay: 0, op: 0.9 },\n  { dx: 0.1, dy: 0.07, len: 0.26, thick: 4, delay: 2, op: 0.7 },\n  { dx: -0.16, dy: -0.08, len: 0.18, thick: 3, delay: 3, op: 0.5 },\n];\n\nfunction ramp(t: number, from: number, len: number) {\n  return interpolate(t, [from, from + len], [0, 1], CLAMP);\n}\n\n/** A short hit: up in 1 frame, eases back over `len`. */\nfunction kick(d: number, len = 8) {\n  if (d < 0) return 0;\n  if (d < 1) return d;\n  const k = Math.max(0, 1 - (d - 1) / len);\n  return k * k;\n}\n\nfunction starPath(L: number, w: number) {\n  return `M0 ${-L} L${w} ${-w} L${L} 0 L${w} ${w} L0 ${L} L${-w} ${w} L${-L} 0 L${-w} ${-w} Z`;\n}\n\nexport function ComboCounter({\n  hits = [\n    \"Captions\",\n    \"Transitions\",\n    \"Logo reveal\",\n    \"Backgrounds\",\n    \"Charts\",\n    \"Text effects\",\n    \"Lower thirds\",\n    \"Mockups\",\n    \"Countdowns\",\n    \"Kinetic type\",\n    \"Particles\",\n    \"Templates\",\n  ],\n  ratings = [\n    { from: 2, text: \"Nice\" },\n    { from: 6, text: \"Great\" },\n    { from: 12, text: \"PERFECT\" },\n  ],\n  accent = \"#3B5BFD\",\n  theme = \"dark\",\n  speed = 1,\n}: ComboCounterProps) {\n  const t = useCurrentFrame() * speed;\n  const { width: W, height: H } = useVideoConfig();\n  const c = THEMES[theme];\n  const u = Math.min(W / 1280, H / 720);\n  const id = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n\n  const times: number[] = [];\n  hits.forEach((_, i) => {\n    times.push(\n      i === 0\n        ? FIRST_HIT\n        : times[i - 1] + (HIT_GAPS[i - 1] ?? HIT_GAPS[HIT_GAPS.length - 1]),\n    );\n  });\n  const lastAt = times[times.length - 1] ?? FIRST_HIT;\n  const n = times.filter((h) => t >= h).length;\n  const lastHit = n > 0 ? times[n - 1] : -99;\n  const final = n === hits.length;\n\n  // ── Meter ─────────────────────────────────────────────────────────────────\n  const numFs = 210 * u;\n  const hitFs = 66 * u;\n  const comboFs = 30 * u;\n  const rateFs = 70 * u;\n  const meterIn = n >= 2 ? OUT(ramp(t, times[1], 6)) : 0;\n  const d = t - lastHit;\n  const hitAmp = final ? 0.24 : 0.08 + 0.012 * n;\n  const pop = 1 + hitAmp * kick(d, final ? 10 : 6);\n  const shakeAmp = (final ? 16 : 3 + 0.9 * n) * u;\n  const sd = Math.floor(d);\n  const shakeK = sd >= 0 && sd < 8 ? (1 - sd / 8) ** 2 : 0;\n  const shx = shakeAmp * shakeK * Math.sin(sd * 2.7 + 0.4);\n  const shy = shakeAmp * 0.5 * shakeK * Math.cos(sd * 3.3);\n\n  // Glide to the poster: the meter block is laid out from its left edge, so\n  // the target x centres an estimate of its width (number + label column).\n  const glide = INOUT(ramp(t, lastAt + GLIDE_DELAY, GLIDE_LEN));\n  const digits = String(hits.length).length;\n  const blockW = digits * 0.6 * numFs + 0.24 * numFs + 2.1 * hitFs;\n  const posterK = 1.65;\n  const gx = interpolate(\n    glide,\n    [0, 1],\n    [0.075 * W, W / 2 - (blockW * posterK) / 2],\n  );\n  const gy = interpolate(glide, [0, 1], [0.47 * H, 0.47 * H]);\n  const gk = interpolate(glide, [0, 1], [1, posterK]);\n  const fillP = OUT(ramp(t, lastAt + FILL_DELAY, FILL_LEN));\n  const logoP = OUT(ramp(t, lastAt + LOGO_DELAY, 10));\n\n  const numberGlyphs = (text: string, gradient: boolean) => (\n    <div\n      style={{\n        fontFamily: sairaItalic,\n        fontStyle: \"italic\",\n        fontWeight: 500,\n        fontSize: numFs,\n        lineHeight: 0.8,\n        letterSpacing: \"-0.03em\",\n        paddingRight: 0.08 * numFs,\n        fontVariantNumeric: \"tabular-nums\",\n        whiteSpace: \"nowrap\",\n        ...(gradient\n          ? {\n              backgroundImage: c.number,\n              WebkitBackgroundClip: \"text\",\n              backgroundClip: \"text\",\n              color: \"transparent\",\n            }\n          : { color: c.ink }),\n      }}\n    >\n      {text}\n    </div>\n  );\n\n  return (\n    <AbsoluteFill style={{ background: c.stage, overflow: \"hidden\" }}>\n      <svg width={0} height={0} style={{ position: \"absolute\" }} aria-hidden>\n        <defs>\n          <linearGradient id={`${id}-sw`} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\">\n            <stop offset=\"0\" stopColor={SWIRL[0]} />\n            <stop offset=\"0.45\" stopColor={SWIRL[1]} />\n            <stop offset=\"1\" stopColor={SWIRL[2]} />\n          </linearGradient>\n        </defs>\n      </svg>\n\n      {/* Hit-sparks: one per feature. */}\n      {hits.map((word, i) => {\n        const h = times[i];\n        const dd = t - h;\n        if (dd < 0 || dd > WORD_LIFE + 4) return null;\n        const slot = SLOTS[i % SLOTS.length];\n        const x = slot.x * W;\n        const y = slot.y * H;\n        const isFinal = i === hits.length - 1;\n        const wordIn = SLAM(ramp(dd, 0, 4));\n        const out = ramp(dd, WORD_LIFE - 3, 5);\n        const starP = ramp(dd, 0, 7);\n        const L =\n          interpolate(OUT(starP), [0, 1], [50, isFinal ? 190 : 120]) * u;\n        const streak = OUT(ramp(dd, 0, 3));\n        const streakOut = ramp(dd, 3, 6);\n        const sl = 0.2 * W * streak;\n        return (\n          <div key={`${i}-${word}`}>\n            <svg\n              width={W}\n              height={H}\n              style={{ position: \"absolute\", inset: 0 }}\n              aria-hidden\n            >\n              <g\n                transform={`translate(${x} ${y}) rotate(${-22 + slot.r})`}\n                opacity={1 - streakOut}\n              >\n                <path\n                  d={`M${-sl} 0 L0 ${-5 * u} L${sl} 0 L0 ${5 * u} Z`}\n                  fill={`url(#${id}-sw)`}\n                />\n              </g>\n              <g\n                transform={`translate(${x - word.length * 0.25 * 62 * u - 34 * u} ${y - 6 * u})`}\n                opacity={1 - starP}\n              >\n                <path d={starPath(L, 7 * u)} fill={`url(#${id}-sw)`} />\n                <path\n                  d={starPath(L * 0.45, 4 * u)}\n                  fill={c.flash}\n                  transform=\"rotate(45)\"\n                />\n              </g>\n            </svg>\n            <div\n              style={{\n                position: \"absolute\",\n                left: x - 0.3 * W,\n                width: 0.6 * W,\n                top: y - 50 * u,\n                height: 100 * u,\n                display: \"flex\",\n                alignItems: \"center\",\n                justifyContent: \"center\",\n                transform: `translateY(${-18 * u * out}px) rotate(${slot.r}deg) scale(${interpolate(wordIn, [0, 1], [1.4, 1]) * (1 - 0.08 * out)})`,\n                opacity: ramp(dd, 0, 2) * (1 - out),\n                fontFamily: sairaItalic,\n                fontStyle: \"italic\",\n                fontWeight: 500,\n                fontSize: 62 * u,\n                lineHeight: 1,\n                letterSpacing: \"-0.01em\",\n                color: c.ink,\n                whiteSpace: \"nowrap\",\n              }}\n            >\n              {word}\n            </div>\n          </div>\n        );\n      })}\n\n      {/* Poster slashes behind the meter. */}\n      {glide > 0 ? (\n        <svg\n          width={W}\n          height={H}\n          style={{ position: \"absolute\", inset: 0 }}\n          aria-hidden\n        >\n          {POSTER_SLASHES.map((p) => {\n            const g = OUT(ramp(t, lastAt + GLIDE_DELAY + 6 + p.delay, 8));\n            const len = p.len * W * g;\n            return (\n              <g\n                key={p.dy}\n                transform={`translate(${W / 2 + p.dx * W} ${0.4 * H + p.dy * H}) rotate(-22)`}\n              >\n                <path\n                  d={`M${-len} 0 L0 ${-p.thick * u} L${len} 0 L0 ${p.thick * u} Z`}\n                  fill={`url(#${id}-sw)`}\n                  opacity={p.op}\n                />\n              </g>\n            );\n          })}\n        </svg>\n      ) : null}\n\n      {/* The combo meter. */}\n      {n >= 2 ? (\n        <div\n          style={{\n            position: \"absolute\",\n            left: gx,\n            top: gy,\n            transform: `translate(${shx}px, ${shy}px) translateY(-50%) scale(${gk})`,\n            transformOrigin: \"0% 50%\",\n            opacity: meterIn,\n          }}\n        >\n          <div\n            style={{\n              display: \"flex\",\n              alignItems: \"flex-end\",\n              gap: 0.16 * numFs,\n            }}\n          >\n            <div\n              style={{\n                position: \"relative\",\n                transform: `scale(${pop * interpolate(meterIn, [0, 1], [1.5, 1])})`,\n                transformOrigin: \"100% 100%\",\n              }}\n            >\n              {numberGlyphs(String(n), false)}\n              {fillP > 0 ? (\n                <div\n                  style={{\n                    position: \"absolute\",\n                    inset: 0,\n                    clipPath: `inset(0 ${(1 - fillP) * 100}% 0 0)`,\n                  }}\n                >\n                  {numberGlyphs(String(n), true)}\n                </div>\n              ) : null}\n            </div>\n            <div\n              style={{\n                display: \"flex\",\n                flexDirection: \"column\",\n                paddingBottom: 0.02 * numFs,\n              }}\n            >\n              <div\n                style={{\n                  fontFamily: sairaItalic,\n                  fontStyle: \"italic\",\n                  fontWeight: 500,\n                  fontSize: hitFs,\n                  lineHeight: 0.9,\n                  letterSpacing: \"0.01em\",\n                  color: c.ink,\n                }}\n              >\n                HIT\n              </div>\n              <div\n                style={{\n                  fontFamily: saira,\n                  fontWeight: 500,\n                  fontSize: comboFs,\n                  lineHeight: 1,\n                  letterSpacing: \"0.28em\",\n                  color: c.dim,\n                  marginTop: 0.12 * hitFs,\n                }}\n              >\n                COMBO\n              </div>\n            </div>\n          </div>\n\n          {/* Rating: swaps as the combo climbs. */}\n          <div\n            style={{\n              position: \"relative\",\n              height: rateFs * 1.2,\n              marginTop: 0.14 * numFs,\n            }}\n          >\n            {ratings.map((r, k) => {\n              const startAt = times[r.from - 1];\n              if (startAt === undefined) return null;\n              const next = ratings[k + 1];\n              const endAt = next ? times[next.from - 1] : undefined;\n              if (t < startAt) return null;\n              if (endAt !== undefined && t >= endAt + 2) return null;\n              const inP = SLAM(ramp(t, startAt, 5));\n              const outP = endAt !== undefined ? ramp(t, endAt, 2) : 0;\n              const isLast = k === ratings.length - 1;\n              return (\n                <div\n                  key={r.text}\n                  style={{\n                    position: \"absolute\",\n                    left: 0,\n                    top: 0,\n                    display: \"flex\",\n                    alignItems: \"center\",\n                    gap: 0.28 * rateFs,\n                    transform: `translateY(${-0.5 * rateFs * outP}px) scale(${interpolate(inP, [0, 1], [1.45, 1])})`,\n                    transformOrigin: \"0% 50%\",\n                    opacity: ramp(t, startAt + (k > 0 ? 1 : 0), 2) * (1 - outP),\n                    whiteSpace: \"nowrap\",\n                  }}\n                >\n                  <div\n                    style={{\n                      width: 0.16 * rateFs,\n                      height: 0.62 * rateFs,\n                      background: accent,\n                      transform: \"skewX(-14deg)\",\n                    }}\n                  />\n                  <div\n                    style={{\n                      fontFamily: sairaItalic,\n                      fontStyle: \"italic\",\n                      fontWeight: isLast ? 500 : 400,\n                      fontSize: rateFs,\n                      lineHeight: 1,\n                      letterSpacing: isLast ? \"0.06em\" : \"-0.01em\",\n                      color: c.ink,\n                    }}\n                  >\n                    {r.text}\n                  </div>\n                </div>\n              );\n            })}\n          </div>\n        </div>\n      ) : null}\n\n      {/* Logo. */}\n      <div\n        style={{\n          position: \"absolute\",\n          left: 0,\n          width: W,\n          top: 0.88 * H,\n          display: \"flex\",\n          justifyContent: \"center\",\n          opacity: logoP,\n          transform: `translateY(${(1 - logoP) * 16 * u}px)`,\n        }}\n      >\n        <RemocnLogo fontSize={30 * u} color={c.ink} />\n      </div>\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/combo-counter.tsx"
    }
  ],
  "type": "registry:component"
}
