{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "wordmark-cut",
  "title": "Wordmark Cut",
  "description": "Wordmark reveal end card: a huge brand name with a hard cut to a close-up. A wordmark twice the width of the frame, cooling from a lit gradient to ink while it settles, and then a hard cut onto its last letters and the dot — 1.71× nearer, with a shallow depth of field the wide shot does not have, which is the only thing that says the second shot is closer rather than just bigger. It holds a beat and pushes in, still accelerating on the last frame.",
  "dependencies": [
    "remotion",
    "@remotion/google-fonts"
  ],
  "registryDependencies": [
    "https://snapcn.dev/r/snap-cn-ui.json"
  ],
  "files": [
    {
      "path": "registry/snap-cn/wordmark-cut/index.tsx",
      "content": "// Wordmark Cut · snapcn — https://snapcn.dev/docs/scenes/wordmark-cut\n\"use client\";\n\nimport { loadFont as loadSans } from \"@remotion/google-fonts/Inter\";\nimport {\n  AbsoluteFill,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\nimport {\n  mixOklch,\n  resolveFont,\n  type SnapCnTheme,\n  useSnapCnTheme,\n} from \"@/lib/snap-cn-ui\";\n\n/**\n * A wordmark twice the width of the frame, cooling from a lit gradient to ink,\n * cut closer onto its last letters and the dot.\n *\n * Two shots and a hard cut between them. The wide one holds the front of the\n * word, rides an exponential settle up into place while the light on the type\n * cools out, and then starts drifting left — accelerating, so the cut\n * lands on a frame that is already moving. The close one is 1.71× nearer, holds\n * the *end* of the word, springs into place, waits, and pushes in. The dot never\n * cools: it is the one thing in the piece that keeps the gradient, and the close\n * shot is framed on it.\n *\n * Beat by beat, measured off the reference at 30fps:\n *\n * | beat | seconds | what moves |\n * | --- | --- | --- |\n * | settle | 0 – 0.8 | the word rises 50px, exponentially |\n * | cool | 0.36 – 1.03 | the light on the type goes to ink, linearly |\n * | drift | 0.66 – 1.20 | the word slides 21px left, accelerating |\n * | **cut** | 1.20 | 245px type → 419px type, front of the word → end of it |\n * | spring | 1.20 – 1.45 | the close shot lands, overshooting 5px |\n * | hold | 1.45 – 1.63 | nothing moves |\n * | push | 1.63 – 2.20 | 1 → 1.30, still accelerating at the last frame |\n *\n * The two shots are not one continuous move with a jump in it — the wide one is\n * *accelerating* left when it ends and the close one is *decelerating* when it\n * begins. It is the same camera on the same word, twice, and the cut is what\n * makes the second one read as closer rather than as bigger.\n *\n * The wide shot has no depth of field and the close one does — sharp in the\n * middle of the frame, six pixels of blur by the corners. That is not a mistake\n * to be tidied away: it is the only thing in the piece that says the second shot\n * is *nearer* rather than the same shot at a larger point size, and it was\n * measured, one edge at a time, before it was believed. A 't' stem 1px sharp at\n * mid-frame and 15px soft at its own ascender tip is not something a font does.\n */\n\nconst { fontFamily: SANS } = loadSans(\"normal\", {\n  weights: [\"500\"],\n  subsets: [\"latin\"],\n});\n\n/* ─────────────────────────────────────────────────────────────────────────\n   Geometry, in the reference's own 712×398 pixels\n   ───────────────────────────────────────────────────────────────────────── */\n\nexport const REF_W = 712;\nexport const REF_H = 398;\n\n/** When the wide shot becomes the close one. */\nexport const CUT = 1.2;\n\n/**\n * The two framings.\n *\n * `size` is a point size and `baseline` is where the baseline sits, both in\n * reference px. The wide shot anchors the word's **left** edge 42px off the\n * frame — its first letter is cut, which is what makes the type read as bigger\n * than the frame rather than merely large. The close shot anchors the **dot**,\n * because the dot is what it is framed on and because anchoring the right-hand\n * end is the only way to place a line of unknown width without measuring it.\n *\n * 419 / 245 = 1.71, read off the stem widths: 25.5px of stem in the wide shot\n * and 41 in the close one. Cap heights would have been easier and are not\n * available — the wide shot's baseline is 10px below the bottom of the frame.\n */\nexport const WIDE = { size: 245, inkTop: 224, left: -42 };\nexport const CLOSE = { size: 419, dot: { x: 418.5, y: 259.2 } };\n\n/**\n * How tall the word's ink is, as a fraction of the point size — and therefore\n * how far the point size has to open up.\n *\n * The reference's word is \"Product.\": a cap, two ascenders, letters that reach\n * 0.75em above the baseline. A wordmark that is all x-height reaches 0.546em,\n * and set at the same point size it sits in the frame like a caption. So the\n * *ink* is what the two framings are measured against and the point size follows\n * from it — which is what a designer does when the word changes, and the only\n * rule that survives not knowing the word.\n *\n * At 0.75 this returns the reference's own 245 and 419 unchanged.\n */\nexport function inkRatio(word: string): number {\n  // 0.556, not the 0.546 x-height: round lowercase overshoots it by 0.01em, and\n  // three pixels of overshoot is three pixels of framing.\n  return /[A-Z0-9bdfhiklt]/.test(word) ? 0.75 : 0.556;\n}\n\nexport function sizeFor(shot: \"wide\" | \"close\"): number {\n  return shot === \"wide\" ? WIDE.size : CLOSE.size;\n}\n\n/**\n * Where each shot puts the baseline, in reference px.\n *\n * Neither shot has a fixed one, and they are anchored on opposite things. The\n * wide shot is framed on the **top of the ink** — 224, a little over half way\n * down — so a word with no ascenders sits where \"Product.\"'s cap sits rather\n * than 50px lower, floating in the page. The close shot is framed on the\n * **dot**, because that is what it is a shot of; the baseline is then wherever\n * the dot's own radius puts it.\n *\n * For \"Product.\" both come out at the reference's own numbers, 408 and 308.\n */\nexport function baselineFor(shot: \"wide\" | \"close\", word: string): number {\n  return shot === \"wide\"\n    ? WIDE.inkTop + inkRatio(word) * WIDE.size\n    : CLOSE.dot.y + (DOT.size * CLOSE.size) / 2;\n}\n\n/**\n * The dot, as a fraction of the point size.\n *\n * 0.234em — two and a half times a real period, and round rather than square.\n * It sits *on* the baseline (centre one radius above it) and follows the word\n * after a 0.06em gap.\n */\nexport const DOT = { size: 0.2348, gap: 0.06 };\n\n/**\n * Where the baseline sits inside a `line-height: 1` box, as a fraction of the\n * point size.\n *\n * Inter's ascent and descent are 0.9688 and 0.2422, so a 1em line box carries\n * half-leading of −0.1055em and puts the baseline 0.8633em down. Everything here\n * is positioned from a baseline, because that is the only line in a piece of\n * type that a camera can be aimed at.\n */\nexport const BASELINE_IN_BOX = 0.8633;\n\n/* ─────────────────────────────────────────────────────────────────────────\n   Curves — every number below was read off the reference's own frames\n   ───────────────────────────────────────────────────────────────────────── */\n\nfunction knots(\n  ts: readonly number[],\n  vs: readonly number[],\n  t: number,\n): number {\n  return interpolate(t, ts as number[], vs as number[], {\n    extrapolateLeft: \"clamp\",\n    extrapolateRight: \"clamp\",\n  });\n}\n\n/**\n * The wide shot's rise, in reference px.\n *\n * Read off the top row of ink: 274 down to 224 and then nothing. It is very\n * nearly `50·exp(−t/0.19)` and it is knots anyway, because the first tenth of a\n * second decays faster than the rest and a single exponential is 6px wrong\n * there — which on a settle this small is an eighth of the whole move.\n *\n * 50px is where the reference *was* when the capture starts, not where its\n * entrance began; that happened about 0.2s earlier, off the front of the clip.\n * Extrapolating the exponential backwards would put the word 140px low at t=0,\n * and inventing 90px of entrance nobody has seen is not matching a reference.\n */\nexport const RISE_T = [0, 0.058, 0.158, 0.258, 0.392, 0.525, 0.825, 1.2];\nexport const RISE_V = [50, 31, 20, 13, 7, 3, 0, 0];\n\nexport function rise(t: number): number {\n  return knots(RISE_T, RISE_V, t);\n}\n\n/**\n * The wide shot's drift, in reference px.\n *\n * Zero until 0.66 and then a `^3.08` ease-in that has covered 21px by the last\n * frame the recording caught and 27 by the cut — an acceleration, not a slide,\n * so the fastest frame of it is the one the cut takes. Fitted rather than\n * knotted: the power law is inside 2px of all sixteen measured frames, and a\n * curve whose whole job is to be still accelerating when it is interrupted is\n * better written as the thing it is than as a table that stops.\n *\n * The span runs to the cut, not to the end of the measurements. Ending it at\n * 1.16 froze the drift for the last frame before the cut, which is the one frame\n * it must not be still on.\n */\nexport const DRIFT = {\n  start: 0.66,\n  span: CUT - 0.66,\n  distance: 26.8,\n  power: 3.08,\n};\n\nexport function drift(t: number): number {\n  const u = Math.min(1, Math.max(0, (t - DRIFT.start) / DRIFT.span));\n  return -DRIFT.distance * u ** DRIFT.power;\n}\n\n/**\n * How much light is left on the type, 0…1.\n *\n * Held at 0.455 for a third of a second and then straight down to nothing by\n * 1.03 — measured as the red channel of the glyph cores, which is a clean\n * readout because the gradient holds R at 255 across its whole length and only\n * G moves. So R/255 *is* the strength, at any point along the word.\n *\n * It never reaches full strength inside the clip. Like the rise, the reference\n * is already partway through this beat when the capture starts.\n */\nexport const WARM_T = [0, 0.358, 0.458, 0.592, 0.858, 1.017, 1.025, 1.2];\nexport const WARM_V = [0.455, 0.451, 0.404, 0.314, 0.106, 0.016, 0, 0];\n\nexport function warmth(t: number): number {\n  return knots(WARM_T, WARM_V, t);\n}\n\n/**\n * The close shot, tracked on the dot — the one object in it with an edge on\n * every side and a colour nothing else shares.\n *\n * Its area gives the scale to a hundredth of a percent (a 98px disc is 7,600\n * pixels; a centroid on that many is worth a fiftieth of a pixel), which is why\n * the push below is knots off a measurement rather than a spring anybody tuned.\n *\n * Times are from the cut, not from the start of the piece.\n */\nexport const B_T = [0, 0.333, 0.533, 0.708, 0.808, 0.875, 0.933, 0.967, 1];\nexport const B_SCALE = [\n  0.9995, 0.9989, 1.0159, 1.0556, 1.0986, 1.1398, 1.1994, 1.2402, 1.2971,\n];\nexport const B_DX_T = [0, 0.133, 0.3, 0.775, 0.967, 1];\nexport const B_DX = [6.46, 1.96, 0.12, -1.43, -4.08, -5.07];\n/**\n * The vertical is the one axis with an overshoot in it: down 18px, 5px past the\n * mark, and back. The horizontal has none. Two different settles on one object\n * is not something to average out — it is what stops the landing reading as a\n * slide.\n */\nexport const B_DY_T = [\n  0, 0.108, 0.133, 0.2, 0.267, 0.433, 0.533, 0.775, 0.933, 1,\n];\nexport const B_DY = [\n  13.83, 2.7, -1.09, -4.48, -4.53, -0.32, -0.35, -3.27, -5.13, -7.03,\n];\n\nexport function closeScale(t: number): number {\n  return knots(B_T, B_SCALE, Math.max(0, t - CUT));\n}\nexport function closeOffset(t: number): { x: number; y: number } {\n  const u = Math.max(0, t - CUT);\n  return { x: knots(B_DX_T, B_DX, u), y: knots(B_DY_T, B_DY, u) };\n}\n\n/**\n * The close shot's depth of field.\n *\n * Sharp out to about 170px from the middle of the frame and fully soft by 215,\n * with a σ of 6. Measured as the 10–90 width of a glyph edge against its\n * distance from the centre: 1px at 92, 3px at 124, 3px at 165, 7px at 192,\n * 15px at 205 and 16px at 310. It is a late, steep falloff — a wide aperture,\n * not a vignette — and guessing 120 → 230 for it left the letter next to the dot\n * eight pixels soft where the reference has one.\n *\n * The wide shot has none of it, at every edge it has, which is the check that\n * this is a lens and not the encoder.\n */\nexport const FOCUS = { sigma: 6, inner: 170, outer: 215 };\n\n/* ─────────────────────────────────────────────────────────────────────────\n   Component\n   ───────────────────────────────────────────────────────────────────────── */\n\nexport interface WordmarkCutProps {\n  /** The wordmark. A trailing \".\" is dropped — the dot is drawn, not typed. */\n  word?: string;\n  /**\n   * The dot's gradient, and the light the type cools out of. Both ends of one\n   * ramp: the dot paints it at full strength and the type at `warm`, so they\n   * cannot drift apart.\n   *\n   * Defaults to the design system's own `primary` lifted to a cyan. The\n   * reference's is `#ff6100 → #fff100`, which is its brand and not ours.\n   */\n  dotFrom?: string;\n  dotTo?: string;\n  /** How much light the type carries at its hottest, 0…1. */\n  warm?: number;\n  /** Design-system token overrides. */\n  theme?: Partial<SnapCnTheme>;\n  mode?: \"light\" | \"dark\";\n  /**\n   * The face this scene paints its word in — a label from `fonts.ts` or a CSS\n   * family you have loaded yourself. Overrides `theme.fontFamily`.\n   */\n  fontFamily?: string;\n  /** 1 is the measured speed. */\n  speed?: number;\n}\n\nexport function WordmarkCut({\n  word = \"snapcn.\",\n  dotFrom = \"#3072db\",\n  dotTo = \"#4fd8f5\",\n  warm = 1,\n  theme,\n  mode,\n  fontFamily,\n  speed = 1,\n}: WordmarkCutProps) {\n  const frame = useCurrentFrame();\n  const { fps, width, height } = useVideoConfig();\n  const t = (frame * speed) / fps;\n\n  const th = useSnapCnTheme(theme, mode);\n  const face = resolveFont(fontFamily ?? th.fontFamily) ?? SANS;\n\n  const k = Math.min(width / REF_W, height / REF_H);\n  const ox = (width - REF_W * k) / 2;\n  const oy = (height - REF_H * k) / 2;\n\n  const text = word.replace(/\\.+$/, \"\");\n  const close = t >= CUT;\n  const heat = close ? 0 : warmth(t) * warm;\n  // The reference cools to a flat black; this cools to the palette's ink, which\n  // is #141414 and not #000, so the last few frames of the beat sit a shade\n  // short of it. That is the trade the design system asks for, and it is the\n  // whole of the difference between the two.\n  const from = mixOklch(dotFrom, th.foreground, 1 - heat);\n  const to = mixOklch(dotTo, th.foreground, 1 - heat);\n\n  const line = (\n    <Line\n      dotFrom={dotFrom}\n      dotTo={dotTo}\n      face={face}\n      from={from}\n      baseline={baselineFor(close ? \"close\" : \"wide\", text)}\n      size={sizeFor(close ? \"close\" : \"wide\")}\n      text={text}\n      to={to}\n      wide={!close}\n    />\n  );\n\n  const pivot = CLOSE.dot;\n  const offset = closeOffset(t);\n  // The *blurred* copy is the one that gets masked, and it sits on top. Mask\n  // the sharp copy instead and the blurred one's spill shows all round the\n  // letters that are supposed to be in focus — a halo on every glyph, which is\n  // not a shallow depth of field, it is a glow.\n  const mask = `radial-gradient(circle ${FOCUS.outer}px at ${REF_W / 2}px ${REF_H / 2}px, transparent 0%, transparent ${Math.round((100 * FOCUS.inner) / FOCUS.outer)}%, #000 100%)`;\n\n  return (\n    <AbsoluteFill\n      style={{\n        backgroundColor: th.background,\n        fontFamily: face,\n        // The type is under a moving scale for the whole close shot; hinting\n        // would re-snap every stem on every frame and the letterforms boil.\n        textRendering: \"geometricPrecision\",\n        overflow: \"hidden\",\n      }}\n    >\n      <div\n        style={{\n          position: \"absolute\",\n          left: ox,\n          top: oy,\n          width: REF_W,\n          height: REF_H,\n          overflow: \"hidden\",\n          transform: `scale(${k})`,\n          transformOrigin: \"0 0\",\n        }}\n      >\n        {close ? (\n          <>\n            {/* Two copies of one line: the sharp one underneath, the soft one\n                over it through a radial hole. The mask is on the\n                *untransformed* layer, because a depth of field belongs to the\n                lens and not to the thing being filmed — masking inside the\n                camera transform would drag the focal plane along with the\n                push. */}\n            <Camera offset={offset} pivot={pivot} scale={closeScale(t)}>\n              {line}\n            </Camera>\n            <div\n              style={{\n                position: \"absolute\",\n                inset: 0,\n                maskImage: mask,\n                WebkitMaskImage: mask,\n              }}\n            >\n              <Camera\n                blur={FOCUS.sigma}\n                offset={offset}\n                pivot={pivot}\n                scale={closeScale(t)}\n              >\n                {line}\n              </Camera>\n            </div>\n          </>\n        ) : (\n          <div\n            style={{\n              position: \"absolute\",\n              inset: 0,\n              transform: `translate(${drift(t)}px, ${rise(t)}px)`,\n            }}\n          >\n            {line}\n          </div>\n        )}\n      </div>\n    </AbsoluteFill>\n  );\n}\n\n/** The close shot's camera: scale about the dot, then put the dot where it goes. */\nfunction Camera({\n  blur,\n  children,\n  offset,\n  pivot,\n  scale,\n}: {\n  blur?: number;\n  children: React.ReactNode;\n  offset: { x: number; y: number };\n  pivot: { x: number; y: number };\n  scale: number;\n}) {\n  return (\n    <div\n      style={{\n        position: \"absolute\",\n        inset: 0,\n        transform: `translate(${offset.x}px, ${offset.y}px) scale(${scale})`,\n        transformOrigin: `${pivot.x}px ${pivot.y}px`,\n        filter: blur ? `blur(${blur}px)` : undefined,\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\n/**\n * The word and its dot, as one nowrap row.\n *\n * Anchored by the left edge in the wide shot and by the **dot** in the close one\n * — `right` rather than `left`, so a line of unknown width lands with its dot on\n * the mark without anyone having to measure the text first. Measuring it would\n * mean `delayRender`, and a title that cannot draw its first frame until a font\n * has loaded is a worse trade than a layout rule that never needs to know.\n */\nfunction Line({\n  baseline,\n  dotFrom,\n  dotTo,\n  face,\n  from,\n  size,\n  text,\n  to,\n  wide,\n}: {\n  baseline: number;\n  dotFrom: string;\n  dotTo: string;\n  face: string;\n  from: string;\n  size: number;\n  text: string;\n  to: string;\n  wide: boolean;\n}) {\n  const d = DOT.size * size;\n  const top = baseline - BASELINE_IN_BOX * size;\n  const anchored = wide\n    ? { left: WIDE.left }\n    : { right: REF_W - (CLOSE.dot.x + d / 2) };\n  return (\n    <div\n      style={{\n        position: \"absolute\",\n        top,\n        ...anchored,\n        display: \"flex\",\n        alignItems: \"flex-end\",\n        whiteSpace: \"nowrap\",\n        fontFamily: face,\n      }}\n    >\n      <span\n        style={{\n          fontSize: size,\n          fontWeight: 500,\n          lineHeight: 1,\n          // −0.02em. Measured: Inter's own advances put the reference's fifth\n          // stem 20px right of where it sits, and the drift is even across the\n          // word — which is tracking, not a different face.\n          letterSpacing: -0.02 * size,\n          // The light runs across the *word*, not across the frame: the\n          // reference's ramp covers a shade more than one screen width and the\n          // word is a shade wider than one, which is the same thing said twice.\n          backgroundImage: `linear-gradient(90deg, ${from}, ${to})`,\n          WebkitBackgroundClip: \"text\",\n          backgroundClip: \"text\",\n          color: \"transparent\",\n        }}\n      >\n        {text}\n      </span>\n      <span\n        style={{\n          marginLeft: DOT.gap * size,\n          marginBottom: (1 - BASELINE_IN_BOX) * size,\n          width: d,\n          height: d,\n          borderRadius: \"50%\",\n          // 198deg: measured at 18° off vertical, the light end up and to the\n          // right. The dot is the one thing in the piece that never cools.\n          backgroundImage: `linear-gradient(198deg, ${dotTo}, ${dotFrom})`,\n          flexShrink: 0,\n        }}\n      />\n    </div>\n  );\n}\n\nexport default WordmarkCut;\n",
      "type": "registry:component",
      "target": "components/snap-cn/wordmark-cut.tsx"
    }
  ],
  "docs": "Docs and props: https://snapcn.dev/docs/scenes/wordmark-cut?ref=cli — pass word for the wordmark and dotFrom/dotTo for the gradient. — 82 Pro components too — charts, launch scenes, device shots: https://snapcn.dev/docs/pricing?ref=cli-docs",
  "type": "registry:component"
}
