{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bounce-logo",
  "title": "Bounce Logo",
  "description": "The wordmark bounces around the frame like an old DVD logo until it hits the corner.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "files": [
    {
      "path": "registry/remocn/bounce-logo/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont as loadSerif } from \"@remotion/google-fonts/InstrumentSerif\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport { useId } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst manrope = loadManrope(\"normal\", {\n  weights: [\"500\", \"600\"],\n  subsets: [\"latin\"],\n});\nconst serif = loadSerif(\"italic\", { weights: [\"400\"], subsets: [\"latin\"] });\n\nexport interface BounceLogoProps {\n  /** Wordmark that bounces. \"remocn\" (any case) is set as the real logo. */\n  brand?: string;\n  /** Line under the final lockup. Pass \"\" to hide. */\n  line?: string;\n  accent?: string;\n  theme?: \"dark\" | \"light\";\n  speed?: number;\n}\n\n// Beat sheet (30fps):\n//   0–112   the logo glides at constant speed and bounces off the frame edges,\n//           flipping neutral ↔ accent on every hit; two near-miss corners at\n//           ~15 and ~64, the second one by a hair\n//   112     dead-on bottom-right corner: a beam of light blooms out of the hit\n//           corner and stays as the ground\n//   116–138 the logo glides to center and grows into the lockup\n//   134–148 the line rises in under it\n//   148–168 poster hold\n// The path is solved backwards from the corner, so the last hit always lands.\nconst CORNER = 112;\nconst PERIOD_X = 48.6;\nconst PERIOD_Y = 47.13;\nconst RESOLVE_AT = CORNER + 4;\nconst RESOLVE = 22;\nconst LINE_AT = CORNER + 22;\nexport const BOUNCE_LOGO_DURATION = CORNER + 56;\n\n/** Manrope 500 advance widths (per mille) for ASCII 32–126 (non-logo brands). */\nconst ADV = [\n  200, 329, 417, 924, 602, 901, 657, 229, 435, 435, 446, 575, 278, 420, 270,\n  402, 626, 406, 578, 562, 596, 580, 621, 512, 591, 621, 314, 318, 622, 750,\n  622, 534, 907, 646, 619, 723, 681, 575, 510, 714, 697, 249, 476, 612, 518,\n  846, 696, 732, 616, 732, 640, 630, 600, 708, 616, 949, 622, 574, 630, 412,\n  402, 412, 673, 660, 506, 562, 600, 561, 600, 590, 362, 600, 604, 249, 263,\n  510, 249, 865, 604, 600, 600, 600, 374, 530, 412, 604, 523, 779, 536, 538,\n  531, 430, 269, 430, 680,\n];\nconst TRACK = -0.03;\n\n/** The real remocn \"R\" mark (viewBox 124.06 × 134.26). */\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/** As on remocn.dev: the mark is 0.76em tall and sits 0.04em before \"emocn\". */\nconst MARK_H = 0.76;\nconst MARK_W = (MARK_H * 124.06) / 134.26;\nconst MARK_GAP = 0.04;\n/** \"emocn\" in Manrope 600 at -0.025em, kerned (em). */\nconst LOGO_WORD_W = 3.15;\n/** Manrope cap height (em), the box of a plain wordmark. */\nconst CAP = 0.72;\n\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst BLOOM = Easing.bezier(0.12, 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    line: \"rgba(243,242,239,0.78)\",\n    key: \"rgba(255,255,255,0.05)\",\n    grain: 0.07,\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    fg: \"#121214\",\n    line: \"rgba(18,18,20,0.72)\",\n    key: \"rgba(255,255,255,0.9)\",\n    grain: 0.045,\n  },\n} as const;\n\n/**\n * The corner bloom. Dark: gradients.sh \"beam\" (#f4f7ff → #8fb4ff → #3d5bff →\n * #1a1660). Light: \"pixel-glass\" (#3d6bff, #ff4fb8, #7a3cff) fading into the\n * off-white. `r` is the bloom radius in px, `drift` a few px of slow travel.\n */\nfunction bloomGround(\n  theme: \"dark\" | \"light\",\n  r: number,\n  drift: number,\n  W: number,\n  H: number,\n) {\n  const at = `${W - drift}px ${H + drift * 0.6}px`;\n  const rad = Math.max(1, r);\n  if (theme === \"dark\") {\n    return [\n      `radial-gradient(${rad * 0.42}px ${rad * 0.36}px at ${at}, rgba(244,247,255,0.95) 0%, rgba(143,180,255,0.55) 45%, transparent 100%)`,\n      `radial-gradient(${rad}px ${rad * 0.82}px at ${at}, rgba(143,180,255,0.9) 0%, rgba(61,91,255,0.85) 22%, rgba(26,22,96,0.75) 52%, rgba(26,22,96,0.22) 74%, transparent 100%)`,\n    ].join(\", \");\n  }\n  return [\n    `radial-gradient(${rad * 0.45}px ${rad * 0.38}px at ${at}, rgba(61,107,255,0.9) 0%, rgba(61,107,255,0.4) 50%, transparent 100%)`,\n    `radial-gradient(${rad}px ${rad * 0.82}px at ${at}, rgba(255,79,184,0.72) 0%, rgba(255,79,184,0.5) 26%, rgba(122,60,255,0.32) 54%, rgba(122,60,255,0.08) 76%, transparent 100%)`,\n  ].join(\", \");\n}\n\nfunction wordWidth(text: string) {\n  let w = 0;\n  for (const ch of text) {\n    const code = ch.charCodeAt(0);\n    w += (code >= 32 && code < 127 ? ADV[code - 32] : 600) / 1000;\n    w += TRACK;\n  }\n  return w - TRACK;\n}\n\n/** Triangle wave: unfolded travel → position bouncing inside [0, 1]. */\nfunction fold(v: number) {\n  const m = ((v % 2) + 2) % 2;\n  return m > 1 ? 2 - m : m;\n}\n\n/** Unfolded position at frame f, solved back from the corner hit (1, 1). */\nfunction travel(f: number) {\n  return {\n    x: 1 - (CORNER - f) / PERIOD_X,\n    y: 1 - (CORNER - f) / PERIOD_Y,\n  };\n}\n\nfunction hitsBefore(f: number) {\n  const a = travel(0);\n  const b = travel(Math.min(f, CORNER - 0.001));\n  return Math.floor(b.x) - Math.floor(a.x) + Math.floor(b.y) - Math.floor(a.y);\n}\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, pointerEvents: \"none\" }}\n      aria-hidden\n    >\n      <filter id={id}>\n        <feTurbulence\n          type=\"fractalNoise\"\n          baseFrequency=\"0.9\"\n          numOctaves={2}\n          seed={17}\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 wordmark at font size 100, drawn from its top-left: the real logo (R mark\n * on the baseline + \"emocn\" in Manrope 600) or a plain word in Manrope 500.\n */\nfunction Wordmark({\n  brand,\n  logo,\n  color,\n}: {\n  brand: string;\n  logo: boolean;\n  color: string;\n}) {\n  if (logo) {\n    return (\n      <>\n        <path\n          d={REMOCN_R_PATH}\n          fill={color}\n          transform={`scale(${(100 * MARK_H) / 134.26})`}\n        />\n        <text\n          x={100 * (MARK_W + MARK_GAP)}\n          y={100 * MARK_H}\n          fill={color}\n          fontFamily={manrope.fontFamily}\n          fontWeight={600}\n          fontSize={100}\n          style={{ letterSpacing: \"-0.025em\" }}\n        >\n          emocn\n        </text>\n      </>\n    );\n  }\n  return (\n    <text\n      x={0}\n      y={100 * CAP}\n      fill={color}\n      fontFamily={manrope.fontFamily}\n      fontWeight={500}\n      fontSize={100}\n      style={{ letterSpacing: `${TRACK}em` }}\n    >\n      {brand}\n    </text>\n  );\n}\n\nexport function BounceLogo({\n  brand = \"remocn\",\n  line = \"Hit the corner.\",\n  accent = \"#3B5BFD\",\n  theme = \"dark\",\n  speed = 1,\n}: BounceLogoProps) {\n  const t = useCurrentFrame() * speed;\n  const { width: W, height: H } = useVideoConfig();\n  const c = THEMES[theme];\n\n  // Logo box in em: top of the R (or caps) to the baseline.\n  const logo = brand.trim().toLowerCase() === \"remocn\";\n  const boxW = logo ? MARK_W + MARK_GAP + LOGO_WORD_W : wordWidth(brand);\n  const boxH = logo ? MARK_H : CAP;\n  const fs = (H * 0.068) / boxH;\n  const lw = boxW * fs;\n  const lh = boxH * fs;\n\n  const at = (f: number) => {\n    const p = travel(Math.min(f, CORNER));\n    return { x: fold(p.x) * (W - lw), y: fold(p.y) * (H - lh) };\n  };\n\n  const hits = hitsBefore(t);\n  const bounceColor = hits % 2 === 1 ? accent : c.fg;\n\n  const bloom = interpolate(t, [CORNER, CORNER + 26], [0, 1], {\n    ...CLAMP,\n    easing: BLOOM,\n  });\n  // The hit itself: a short burst of extra light that settles into the bloom.\n  const burst = interpolate(t, [CORNER, CORNER + 1, CORNER + 12], [0, 1, 0], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n  const drift = Math.max(0, t - CORNER) * 0.35 * (H / 720);\n  const resolve = interpolate(t, [RESOLVE_AT, RESOLVE_AT + RESOLVE], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const lineIn = interpolate(t, [LINE_AT, LINE_AT + 16], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n\n  const finalScale = Math.min(2.3, (W * 0.52) / lw);\n  const scale = 1 + (finalScale - 1) * resolve;\n  const lineSize = H * 0.062;\n  const lineGap = lineSize * 0.95;\n  const blockH = lh * finalScale + (line ? lineGap + lineSize * 0.75 : 0);\n  const endX = (W - lw * finalScale) / 2;\n  const endY = (H - blockH) / 2;\n\n  const now = at(t);\n  const x = now.x + (endX - now.x) * resolve;\n  const y = now.y + (endY - now.y) * resolve;\n\n  const settled = t >= CORNER;\n  const color = settled ? c.fg : bounceColor;\n\n  return (\n    <AbsoluteFill style={{ background: c.bg, overflow: \"hidden\" }}>\n      <AbsoluteFill\n        style={{\n          background: `radial-gradient(ellipse 70% 80% at 40% 35%, ${c.key}, transparent 70%)`,\n        }}\n      />\n      {bloom > 0 ? (\n        <AbsoluteFill\n          style={{\n            background: bloomGround(\n              theme,\n              H * (0.15 + 1.25 * bloom + 0.25 * burst),\n              drift,\n              W,\n              H,\n            ),\n          }}\n        />\n      ) : null}\n      <svg\n        width={W}\n        height={H}\n        viewBox={`0 0 ${W} ${H}`}\n        style={{ position: \"absolute\", inset: 0 }}\n        aria-hidden\n      >\n        <g transform={`translate(${x} ${y}) scale(${(fs * scale) / 100})`}>\n          <Wordmark brand={brand} logo={logo} color={color} />\n        </g>\n        {line ? (\n          <text\n            x={W / 2}\n            y={endY + lh * finalScale + lineGap + lineSize * 0.75}\n            textAnchor=\"middle\"\n            fill={c.line}\n            opacity={lineIn}\n            fontFamily={serif.fontFamily}\n            fontStyle=\"italic\"\n            fontWeight={400}\n            fontSize={lineSize}\n            transform={`translate(0 ${(1 - lineIn) * lineSize * 0.5})`}\n            style={{ letterSpacing: \"-0.01em\" }}\n          >\n            {line}\n          </text>\n        ) : null}\n      </svg>\n      <Grain opacity={c.grain} />\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/bounce-logo.tsx"
    }
  ],
  "type": "registry:component"
}
