{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cut-lockup",
  "title": "Cut Lockup",
  "description": "Logo reveal in hard cuts. The logo lands huge on grid paper, steps down in three cuts, pushes in, cuts to night where its construction lines and anchor points draw themselves, then a paper panel wipes up onto the resting lockup. Cuts, scales, push and wipe are measured frame by frame off a reference recording.",
  "dependencies": [
    "remotion"
  ],
  "files": [
    {
      "path": "registry/snap-cn/cut-lockup/index.tsx",
      "content": "// Cut Lockup · snapcn — https://snapcn.dev/docs/scenes/cut-lockup\n\"use client\";\n\nimport type { CSSProperties } from \"react\";\nimport { useId, useMemo } from \"react\";\nimport { AbsoluteFill, useCurrentFrame, useVideoConfig } from \"remotion\";\nimport { SNAPCN_LOGO } from \"./data\";\n\n/**\n * Cut Lockup — a logo in hard cuts. It lands huge on grid paper and steps down\n * in three cuts, pushes in, cuts to night where its construction lines draw\n * themselves, then a paper panel wipes up onto the resting lockup.\n *\n * Every default is measured frame by frame off a 714x390 screen recording at\n * 30fps (\"ref px\"); the stage maps that box onto the composition by width.\n */\n\nexport const REF_W = 714;\nexport const REF_H = 390;\n\nexport interface LogoArt {\n  /** viewBox width/height of `shapes`. */\n  width: number;\n  height: number;\n  /** SVG path data, one entry per shape. Each subpath is drawn as its own construction line. */\n  shapes: string[];\n}\n\nexport interface CutStep {\n  /** Frame the cut lands on. */\n  from: number;\n  /** Logo width, as a multiple of the resting width (`size`). */\n  scale: number;\n  /** Centre offset in logo widths (the huge first cut sits off-centre). */\n  x?: number;\n  y?: number;\n  /** Horizontal drift, logo widths per frame. */\n  drift?: number;\n}\n\n/** Piecewise-linear lookup over [frame, value] pairs, held at the ends. */\nexport const track = (\n  pts: readonly (readonly [number, number])[],\n  t: number,\n) => {\n  if (t <= pts[0]![0]) return pts[0]![1];\n  for (let i = 1; i < pts.length; i++) {\n    const [t1, v1] = pts[i]!;\n    const [t0, v0] = pts[i - 1]!;\n    if (t <= t1) return v0 + ((v1 - v0) * (t - t0)) / (t1 - t0);\n  }\n  return pts[pts.length - 1]![1];\n};\n\n/**\n * Split SVG path data into absolute subpaths and collect each one's anchor points\n * (segment end points) — the dots of the construction view.\n */\nexport const splitPath = (d: string) => {\n  const toks = d.match(/[a-zA-Z]|-?(?:\\d*\\.\\d+|\\d+)(?:e-?\\d+)?/g) ?? [];\n  const subs: { d: string; dots: [number, number][]; minX: number }[] = [];\n  let i = 0;\n  let cmd = \"\";\n  let x = 0;\n  let y = 0;\n  let sx = 0;\n  let sy = 0;\n  let cur: { d: string[]; dots: [number, number][] } | null = null;\n  const n = () => Number(toks[i++]);\n  const flush = () => {\n    if (cur)\n      subs.push({\n        d: cur.d.join(\"\"),\n        dots: cur.dots,\n        minX: Math.min(...cur.dots.map((p) => p[0])),\n      });\n    cur = null;\n  };\n  const f = (v: number) => +v.toFixed(2);\n  while (i < toks.length) {\n    if (/[a-zA-Z]/.test(toks[i]!)) cmd = toks[i++]!;\n    const rel = cmd === cmd.toLowerCase();\n    const C = cmd.toUpperCase();\n    const ox = rel ? x : 0;\n    const oy = rel ? y : 0;\n    if (C === \"Z\") {\n      cur?.d.push(\"Z\");\n      x = sx;\n      y = sy;\n      flush();\n      continue;\n    }\n    if (C === \"M\") {\n      flush();\n      x = ox + n();\n      y = oy + n();\n      sx = x;\n      sy = y;\n      cur = { d: [`M${f(x)} ${f(y)}`], dots: [[x, y]] };\n      cmd = rel ? \"l\" : \"L\";\n      continue;\n    }\n    if (!cur) cur = { d: [`M${f(x)} ${f(y)}`], dots: [[x, y]] };\n    if (C === \"L\" || C === \"T\") {\n      x = ox + n();\n      y = oy + n();\n      cur.d.push(`L${f(x)} ${f(y)}`);\n    } else if (C === \"H\") {\n      x = ox + n();\n      cur.d.push(`L${f(x)} ${f(y)}`);\n    } else if (C === \"V\") {\n      y = oy + n();\n      cur.d.push(`L${f(x)} ${f(y)}`);\n    } else if (C === \"C\") {\n      const p = [ox + n(), oy + n(), ox + n(), oy + n(), ox + n(), oy + n()];\n      [x, y] = [p[4]!, p[5]!];\n      cur.d.push(`C${p.map(f).join(\" \")}`);\n    } else if (C === \"S\" || C === \"Q\") {\n      const p = [ox + n(), oy + n(), ox + n(), oy + n()];\n      [x, y] = [p[2]!, p[3]!];\n      cur.d.push(`${C}${p.map(f).join(\" \")}`);\n    } else if (C === \"A\") {\n      const p = [n(), n(), n(), n(), n(), ox + n(), oy + n()];\n      [x, y] = [p[5]!, p[6]!];\n      cur.d.push(`A${p.join(\" \")}`);\n    } else {\n      i++;\n      continue;\n    }\n    // a closing segment that lands back on the start is not a new anchor\n    if (Math.hypot(x - sx, y - sy) > 1e-6) cur.dots.push([x, y]);\n  }\n  flush();\n  return subs;\n};\n\nconst clamp01 = (v: number) => Math.min(1, Math.max(0, v));\n\nexport interface CutLockupProps {\n  /** Your logo as SVG paths. Defaults to the snapcn mark + wordmark. */\n  logo?: LogoArt;\n  /** Resting logo width as a fraction of the frame width. */\n  size?: number;\n\n  /** Logo ink on paper. */\n  ink?: string;\n  /** Paper: left edge, middle, right edge. */\n  paper?: [string, string, string];\n  /** Grid-paper lines on the left of the paper; pitch in ref px. */\n  grid?: { color: string; pitch: number; width: number };\n  /** Edge roughness of the printed logo, ref px (0 = clean vector edges). */\n  roughness?: number;\n\n  /** The hard cuts on paper, in order. */\n  steps?: CutStep[];\n  /** Push-in before the cut to night: [frame, scale multiplier]. */\n  push?: [number, number][];\n\n  /** Night: background, construction line and anchor dot colours. */\n  night?: string;\n  line?: string;\n  dot?: string;\n  /** Frame the cut to night lands on, and the logo scale there. */\n  nightAt?: number;\n  nightScale?: number;\n  /** Construction drawing: frames per shape, and the left-to-right spread across the logo. */\n  drawFrames?: number;\n  drawSpread?: number;\n\n  /** Paper wipe: [frame, top edge as a fraction of the height]. */\n  wipe?: [number, number][];\n  /** Paper after the wipe, and the logo scale on it. */\n  endPaper?: string;\n  endScale?: number;\n\n  speed?: number;\n}\n\nexport const CutLockup = ({\n  logo = SNAPCN_LOGO,\n  size = 0.2335,\n  ink = \"#1f1f1f\",\n  paper = [\"#f6f6f6\", \"#f8f8f8\", \"#fcfcfc\"],\n  grid = { color: \"rgba(0,0,0,0.014)\", pitch: 22, width: 1 },\n  roughness = 0.35,\n  steps = [\n    { from: 0, scale: 9.525, x: 0.11536, y: -0.00035, drift: -0.0001655 },\n    { from: 8, scale: 4.6105, x: 0.01566, y: 0.00175 },\n    { from: 18, scale: 3.0057, x: -0.003 },\n    { from: 28, scale: 1, x: -0.0083, y: 0.00126 },\n  ],\n  push = [\n    [36, 1],\n    [37, 1.0006],\n    [38, 1.0048],\n    [39, 1.0087],\n    [40, 1.0162],\n    [41, 1.0313],\n    [42, 1.0703],\n  ],\n  night = \"#242424\",\n  line = \"rgba(255,255,255,0.11)\",\n  dot = \"rgba(255,255,255,0.22)\",\n  nightAt = 43,\n  nightScale = 1.154,\n  drawFrames = 7,\n  drawSpread = 22,\n  wipe = [\n    [91, 1],\n    [92, 386 / 390],\n    [93, 376 / 390],\n    [94, 360 / 390],\n    [95, 334 / 390],\n    [96, 277 / 390],\n    [97, 114 / 390],\n    [98, 57 / 390],\n    [99, 31 / 390],\n    [100, 15 / 390],\n    [101, 5 / 390],\n    [102, 0],\n  ],\n  endPaper = \"#f8f8f8\",\n  endScale = 1.1894,\n  speed = 1,\n}: CutLockupProps) => {\n  const fr = useCurrentFrame() * speed;\n  const { width, height } = useVideoConfig();\n  const id = useId().replace(/:/g, \"\");\n  const u = width / REF_W; // px per ref px\n  const restW = size * width;\n\n  const subs = useMemo(\n    () =>\n      logo.shapes.flatMap((d) => splitPath(d)).sort((a, b) => a.minX - b.minX),\n    [logo],\n  );\n\n  // Logo placement: centre offset (logo widths) and scale (× resting width).\n  const place = (scale: number, x = 0, y = 0) => {\n    const w = restW * scale;\n    const k = w / logo.width;\n    const cx = width / 2 + x * w;\n    const cy = height / 2 + y * w;\n    return {\n      k,\n      transform: `translate(${cx} ${cy}) scale(${k}) translate(${-logo.width / 2} ${-logo.height / 2})`,\n    };\n  };\n\n  const rough = (\n    <filter\n      id={`${id}r`}\n      x=\"-5%\"\n      y=\"-5%\"\n      width=\"110%\"\n      height=\"110%\"\n      filterUnits=\"objectBoundingBox\"\n    >\n      <feTurbulence\n        type=\"fractalNoise\"\n        baseFrequency={0.55 / u}\n        numOctaves={1}\n        seed={3}\n      />\n      <feDisplacementMap\n        in=\"SourceGraphic\"\n        scale={roughness * u * 2}\n        xChannelSelector=\"R\"\n        yChannelSelector=\"G\"\n      />\n    </filter>\n  );\n  const fillLogo = (\n    scale: number,\n    x: number | undefined,\n    y: number | undefined,\n    fill: string,\n  ) => {\n    const p = place(scale, x, y);\n    return (\n      <svg\n        width={width}\n        height={height}\n        style={{ position: \"absolute\", inset: 0, overflow: \"visible\" }}\n      >\n        <defs>{rough}</defs>\n        <g filter={roughness > 0 ? `url(#${id}r)` : undefined}>\n          <g transform={p.transform}>\n            <path d={logo.shapes.join(\" \")} fill={fill} fillRule=\"evenodd\" />\n          </g>\n        </g>\n      </svg>\n    );\n  };\n\n  const paperBg: CSSProperties = {\n    background: `linear-gradient(to right, ${paper[0]}, ${paper[1]} 45%, ${paper[2]})`,\n  };\n  const gridBg: CSSProperties = {\n    position: \"absolute\",\n    left: 0,\n    top: 0,\n    bottom: 0,\n    width: 200 * u,\n    backgroundImage: `repeating-linear-gradient(to right, ${grid.color} 0 ${grid.width * u}px, transparent ${grid.width * u}px ${grid.pitch * u}px), repeating-linear-gradient(to bottom, ${grid.color} 0 ${grid.width * u}px, transparent ${grid.width * u}px ${grid.pitch * u}px)`,\n    maskImage: \"linear-gradient(to right, #000 85%, transparent)\",\n    WebkitMaskImage: \"linear-gradient(to right, #000 85%, transparent)\",\n  };\n\n  // ---- 1. hard cuts on paper\n  if (fr < nightAt) {\n    let s = steps[0]!;\n    for (const st of steps) if (fr >= st.from) s = st;\n    const m = track(push, fr);\n    const x = (s.x ?? 0) + (s.drift ?? 0) * (fr - s.from);\n    return (\n      <AbsoluteFill style={paperBg}>\n        <div style={gridBg} />\n        {fillLogo(s.scale * (fr >= push[0]![0] ? m : 1), x, s.y, ink)}\n      </AbsoluteFill>\n    );\n  }\n\n  // ---- 2. night: construction lines, then the paper wipes up\n  const p = place(nightScale, -0.0072, 0.0005);\n  const sw = u / p.k;\n  const span = Math.max(...subs.map((q) => q.minX)) || 1;\n  const top = track(wipe, fr);\n  return (\n    <AbsoluteFill style={{ background: night }}>\n      <svg\n        width={width}\n        height={height}\n        style={{ position: \"absolute\", inset: 0 }}\n      >\n        <g transform={p.transform}>\n          {subs.map((q) => {\n            const a = clamp01(\n              (fr - (nightAt + 1 + (q.minX / span) * drawSpread)) / drawFrames,\n            );\n            if (a <= 0) return null;\n            return (\n              <g key={q.d}>\n                <path\n                  d={q.d}\n                  pathLength={1}\n                  fill=\"none\"\n                  stroke={line}\n                  strokeWidth={sw}\n                  strokeDasharray={`${a} 1`}\n                />\n                {q.dots.map(([dx, dy], j) =>\n                  a * q.dots.length > j ? (\n                    <circle key={`${dx},${dy}`} cx={dx} cy={dy} r={1.1 * sw} fill={dot} />\n                  ) : null,\n                )}\n              </g>\n            );\n          })}\n        </g>\n      </svg>\n      {top < 1 && (\n        <AbsoluteFill\n          style={{\n            background: endPaper,\n            clipPath: `inset(${top * 100}% 0 0 0)`,\n          }}\n        >\n          {fillLogo(endScale, -0.0072, 0.0004, ink)}\n        </AbsoluteFill>\n      )}\n    </AbsoluteFill>\n  );\n};\n\nexport default CutLockup;\n",
      "type": "registry:component",
      "target": "components/snap-cn/cut-lockup/index.tsx"
    },
    {
      "path": "registry/snap-cn/cut-lockup/data.ts",
      "content": "// Cut Lockup · snapcn — https://snapcn.dev/docs/scenes/cut-lockup\n/** The snapcn mark + \"snapcn\" (Poppins 600) as outlines: one path per glyph, so the\n * construction beat can draw each one and put a dot on every anchor. */\nexport const SNAPCN_LOGO = {\n  width: 4637.1,\n  height: 861,\n  shapes: [\n    \"M92.2 44.6C66.0 51.0 44.4 67.9 32.7 91.1C23.3 109.8 23.5 104.2 23.5 284.9C23.5 442.1 23.6 450.7 26.4 459.0C34.0 482.0 49.6 494.3 78.2 500.0C93.9 503.1 98.1 505.1 107.3 513.6C115.6 521.2 118.9 530.6 118.9 546.7C119.1 565.7 125.5 577.4 139.7 584.9L147.9 589.1L301.2 589.6C439.4 590.1 455.5 589.8 464.3 587.6C476.0 584.3 485.1 577.1 491.0 565.8L495.3 557.8L495.7 508.6C496.0 481.5 496.0 455.0 495.7 450.0L495.3 440.6L490.4 448.5C484.8 457.7 474.6 466.5 463.8 471.3L456.1 474.9L329.4 475.4C236.9 475.7 200.3 475.4 194.0 474.1C174.0 469.8 153.7 455.2 143.2 437.5C133.0 420.3 132.9 417.5 133.3 308.3L133.8 210.5L137.5 201.4C144.4 184.0 160.5 168.5 179.8 160.9L188.6 157.3L318.4 156.8C445.0 156.5 448.5 156.5 458.5 159.6C471.0 163.5 481.8 171.2 489.5 181.8L495.3 190.0L495.7 137.7C496.2 80.3 495.3 72.3 487.0 60.4C482.3 53.5 471.6 46.2 463.2 43.8C459.7 42.9 391.7 42.2 279.3 42.4C134.9 42.6 99.2 42.9 92.2 44.6ZM594.6 173.2C543.5 203.9 501.0 229.7 500.4 230.7C499.8 231.6 499.3 270.4 499.6 316.7L500.0 401.2L522.6 415.5C535.2 423.3 555.2 435.8 567.2 443.1C579.3 450.5 611.5 470.4 638.7 487.3C666.0 504.2 689.8 517.9 691.5 517.9C693.2 517.9 695.7 516.9 697.0 515.4C699.1 513.3 699.5 493.4 699.5 319.2C699.5 197.0 698.8 123.9 697.9 121.4C696.8 118.3 695.4 117.4 692.1 117.4C689.3 117.5 655.8 136.6 594.6 173.2Z\",\n    \"M915.1 422.0L1056.1 422.0Q1060.1 454.0 1087.6 475.0Q1115.1 496.0 1156.1 496.0Q1196.1 496.0 1218.6 480.0Q1241.1 464.0 1241.1 439.0Q1241.1 412.0 1213.6 398.5Q1186.1 385.0 1126.1 369.0Q1064.1 354.0 1024.6 338.0Q985.1 322.0 956.6 289.0Q928.1 256.0 928.1 200.0Q928.1 154.0 954.6 116.0Q981.1 78.0 1030.6 56.0Q1080.1 34.0 1147.1 34.0Q1246.1 34.0 1305.1 83.5Q1364.1 133.0 1370.1 217.0L1236.1 217.0Q1233.1 184.0 1208.6 164.5Q1184.1 145.0 1143.1 145.0Q1105.1 145.0 1084.6 159.0Q1064.1 173.0 1064.1 198.0Q1064.1 226.0 1092.1 240.5Q1120.1 255.0 1179.1 270.0Q1239.1 285.0 1278.1 301.0Q1317.1 317.0 1345.6 350.5Q1374.1 384.0 1375.1 439.0Q1375.1 487.0 1348.6 525.0Q1322.1 563.0 1272.6 584.5Q1223.1 606.0 1157.1 606.0Q1089.1 606.0 1035.1 581.5Q981.1 557.0 949.6 515.0Q918.1 473.0 915.1 422.0Z\",\n    \"M2018.1 272.0L2018.1 597.0L1878.1 597.0L1878.1 291.0Q1878.1 225.0 1845.1 189.5Q1812.1 154.0 1755.1 154.0Q1697.1 154.0 1663.6 189.5Q1630.1 225.0 1630.1 291.0L1630.1 597.0L1490.1 597.0L1490.1 43.0L1630.1 43.0L1630.1 112.0Q1658.1 76.0 1701.6 55.5Q1745.1 35.0 1797.1 35.0Q1896.1 35.0 1957.1 97.5Q2018.1 160.0 2018.1 272.0Z\",\n    \"M2368.1 34.0Q2430.1 34.0 2476.6 59.0Q2523.1 84.0 2551.1 122.0L2551.1 43.0L2692.1 43.0L2692.1 597.0L2551.1 597.0L2551.1 516.0Q2524.1 555.0 2476.6 580.5Q2429.1 606.0 2367.1 606.0Q2297.1 606.0 2239.6 570.0Q2182.1 534.0 2148.6 468.5Q2115.1 403.0 2115.1 318.0Q2115.1 234.0 2148.6 169.0Q2182.1 104.0 2239.6 69.0Q2297.1 34.0 2368.1 34.0ZM2404.1 157.0Q2365.1 157.0 2332.1 176.0Q2299.1 195.0 2278.6 231.5Q2258.1 268.0 2258.1 318.0Q2258.1 368.0 2278.6 405.5Q2299.1 443.0 2332.6 463.0Q2366.1 483.0 2404.1 483.0Q2443.1 483.0 2477.1 463.5Q2511.1 444.0 2531.1 407.5Q2551.1 371.0 2551.1 320.0Q2551.1 269.0 2531.1 232.5Q2511.1 196.0 2477.1 176.5Q2443.1 157.0 2404.1 157.0Z\",\n    \"M3152.1 34.0Q3223.1 34.0 3280.6 69.0Q3338.1 104.0 3371.6 168.5Q3405.1 233.0 3405.1 318.0Q3405.1 403.0 3371.6 468.5Q3338.1 534.0 3280.6 570.0Q3223.1 606.0 3152.1 606.0Q3091.1 606.0 3044.6 581.0Q2998.1 556.0 2969.1 518.0L2969.1 861.0L2829.1 861.0L2829.1 43.0L2969.1 43.0L2969.1 123.0Q2996.1 85.0 3043.6 59.5Q3091.1 34.0 3152.1 34.0ZM3115.1 157.0Q3077.1 157.0 3043.6 176.5Q3010.1 196.0 2989.6 233.0Q2969.1 270.0 2969.1 320.0Q2969.1 370.0 2989.6 407.0Q3010.1 444.0 3043.6 463.5Q3077.1 483.0 3115.1 483.0Q3154.1 483.0 3187.6 463.0Q3221.1 443.0 3241.6 406.0Q3262.1 369.0 3262.1 318.0Q3262.1 268.0 3241.6 231.5Q3221.1 195.0 3187.6 176.0Q3154.1 157.0 3115.1 157.0Z\",\n    \"M3745.1 34.0Q3848.1 34.0 3915.6 85.5Q3983.1 137.0 4006.1 230.0L3855.1 230.0Q3843.1 194.0 3814.6 173.5Q3786.1 153.0 3744.1 153.0Q3684.1 153.0 3649.1 196.5Q3614.1 240.0 3614.1 320.0Q3614.1 399.0 3649.1 442.5Q3684.1 486.0 3744.1 486.0Q3829.1 486.0 3855.1 410.0L4006.1 410.0Q3983.1 500.0 3915.1 553.0Q3847.1 606.0 3745.1 606.0Q3665.1 606.0 3603.1 570.5Q3541.1 535.0 3506.1 470.5Q3471.1 406.0 3471.1 320.0Q3471.1 234.0 3506.1 169.5Q3541.1 105.0 3603.1 69.5Q3665.1 34.0 3745.1 34.0Z\",\n    \"M4637.1 272.0L4637.1 597.0L4497.1 597.0L4497.1 291.0Q4497.1 225.0 4464.1 189.5Q4431.1 154.0 4374.1 154.0Q4316.1 154.0 4282.6 189.5Q4249.1 225.0 4249.1 291.0L4249.1 597.0L4109.1 597.0L4109.1 43.0L4249.1 43.0L4249.1 112.0Q4277.1 76.0 4320.6 55.5Q4364.1 35.0 4416.1 35.0Q4515.1 35.0 4576.1 97.5Q4637.1 160.0 4637.1 272.0Z\",\n  ],\n};\n",
      "type": "registry:component",
      "target": "components/snap-cn/cut-lockup/data.ts"
    }
  ],
  "docs": "Docs and props: https://snapcn.dev/docs/scenes/cut-lockup?ref=cli — 108 frames at 30fps; paints its own background. Pass your logo as SVG paths (logo={{ width, height, shapes }}). — 82 Pro components too — charts, launch scenes, device shots: https://snapcn.dev/docs/pricing?ref=cli-docs",
  "type": "registry:component"
}
