{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cinema-aperture-open",
  "type": "registry:component",
  "title": "Cinema Aperture Open",
  "description": "A camera diaphragm of overlapping metal blades rotates open to reveal a city at dusk and the title, with a live f-stop readout. It cycles by itself or opens and closes on demand.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "cinematic",
    "cinematic",
    "iris",
    "aperture",
    "reveal",
    "camera",
    "hero"
  ],
  "docs": "https://hyperblur.dev/effects/cinema-aperture-open",
  "files": [
    {
      "path": "registry/hyperblur/cinema-aperture-open.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/cinema-aperture-open.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CinemaApertureOpenAction {\n  label: string;\n  href: string;\n}\n\nexport interface CinemaApertureOpenProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  kicker?: string;\n  title?: string;\n  subtitle?: string;\n  cta?: CinemaApertureOpenAction | null;\n  blades?: number;\n  autoPlay?: boolean;\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  accent?: string;\n  headingAs?: \"h1\" | \"h2\";\n}\n\nconst css = `\n.hb-vc4 {\n  --hb-vc4-accent: #ff5fa2;\n  position: relative;\n  box-sizing: border-box;\n  display: grid;\n  place-items: center;\n  width: 100%;\n  min-height: 580px;\n  overflow: hidden;\n  isolation: isolate;\n  container-type: inline-size;\n  background: #000;\n  color: #fff;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-vc4 *, .hb-vc4 *::before, .hb-vc4 *::after { box-sizing: border-box; }\n.hb-vc4-scene { position: absolute; inset: 0; z-index: 0; }\n.hb-vc4-scene svg { display: block; width: 100%; height: 100%; }\n.hb-vc4-win { animation: hb-vc4-win 6s steps(1, end) infinite; }\n@keyframes hb-vc4-win {\n  0%, 100% { opacity: 1; }\n  50% { opacity: .35; }\n}\n.hb-vc4-copy {\n  position: relative;\n  z-index: 1;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  max-width: 720px;\n  padding: 0 24px;\n  text-align: center;\n  transform: scale(calc(.92 + var(--hb-vc4-p, 1) * .08));\n  opacity: calc(var(--hb-vc4-p, 1) * 1.4 - .3);\n}\n.hb-vc4-kicker {\n  margin: 0 0 14px;\n  color: rgba(255, 255, 255, .72);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 11px;\n  letter-spacing: .32em;\n  text-transform: uppercase;\n}\n.hb-vc4-title {\n  margin: 0;\n  font-family: var(--font-grotesk, var(--font-sans, ui-sans-serif, system-ui, sans-serif));\n  font-size: clamp(42px, 10cqi, 128px);\n  font-weight: 700;\n  line-height: .9;\n  letter-spacing: -.035em;\n  text-shadow: 0 0 60px color-mix(in srgb, var(--hb-vc4-accent) 45%, transparent);\n}\n.hb-vc4-sub {\n  margin: 18px 0 0;\n  color: rgba(255, 255, 255, .78);\n  font-size: clamp(14px, 1.8cqi, 17px);\n}\n.hb-vc4-cta {\n  display: inline-flex;\n  align-items: center;\n  gap: 10px;\n  height: 44px;\n  margin-top: 26px;\n  padding: 0 20px;\n  border-radius: 999px;\n  background: #fff;\n  color: #0a0a0a;\n  font-size: 14px;\n  font-weight: 600;\n  text-decoration: none;\n  box-shadow: 0 12px 40px -12px var(--hb-vc4-accent);\n  transition: transform .2s ease, box-shadow .3s ease;\n}\n.hb-vc4-cta:hover { box-shadow: 0 16px 50px -10px var(--hb-vc4-accent); }\n.hb-vc4-cta:active { transform: scale(.97); }\n.hb-vc4-cta:focus-visible, .hb-vc4-ctrl:focus-visible { outline: 2px solid var(--hb-vc4-accent); outline-offset: 3px; }\n.hb-vc4-iris {\n  position: absolute;\n  inset: 0;\n  z-index: 2;\n  pointer-events: none;\n}\n.hb-vc4-iris svg { display: block; width: 100%; height: 100%; }\n.hb-vc4-hud {\n  position: absolute;\n  top: 18px;\n  left: clamp(14px, 3cqi, 28px);\n  right: clamp(14px, 3cqi, 28px);\n  z-index: 3;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  color: rgba(255, 255, 255, .7);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 11px;\n  letter-spacing: .16em;\n  text-transform: uppercase;\n}\n.hb-vc4-stop { display: inline-flex; align-items: baseline; gap: 10px; }\n.hb-vc4-stop b {\n  min-width: 4.2ch;\n  color: #fff;\n  font-size: 15px;\n  font-weight: 600;\n  letter-spacing: .04em;\n}\n.hb-vc4-ticks { display: flex; gap: 3px; }\n.hb-vc4-tick { width: 2px; height: 10px; background: rgba(255, 255, 255, .2); transition: background .2s ease; }\n.hb-vc4-tick[data-on=\"true\"] { background: var(--hb-vc4-accent); }\n.hb-vc4-ctrl {\n  position: absolute;\n  bottom: 18px;\n  right: clamp(14px, 3cqi, 28px);\n  z-index: 3;\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  height: 32px;\n  padding: 0 14px;\n  border: 1px solid rgba(255, 255, 255, .2);\n  border-radius: 999px;\n  background: rgba(10, 10, 10, .55);\n  color: #fff;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 10.5px;\n  letter-spacing: .14em;\n  text-transform: uppercase;\n  cursor: pointer;\n  backdrop-filter: blur(8px);\n  transition: border-color .2s ease, background .2s ease;\n}\n.hb-vc4-ctrl:hover { border-color: rgba(255, 255, 255, .45); background: rgba(30, 30, 30, .7); }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vc4-iris { display: none; }\n  .hb-vc4-copy { transform: none; opacity: 1; }\n  .hb-vc4-win { animation: none; }\n}\n`;\n\nconst stops = [\"22\", \"16\", \"11\", \"8\", \"5.6\", \"4\", \"2.8\", \"2\", \"1.4\"];\n\nfunction ease(t: number) {\n  return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;\n}\n\nfunction windows() {\n  const out: { x: number; y: number; on: boolean; blink: boolean }[] = [];\n  const towers = [\n    [60, 380, 90], [170, 300, 70], [260, 420, 110], [400, 260, 80], [500, 350, 120],\n    [640, 210, 90], [750, 330, 100], [880, 280, 80], [980, 390, 120], [1120, 240, 90], [1230, 320, 110], [1360, 280, 100], [1480, 360, 90],\n  ];\n  towers.forEach(([x, y, w], ti) => {\n    for (let r = 0; r < 14; r++) {\n      for (let c = 0; c < Math.floor(w / 16); c++) {\n        const h = Math.imul(ti * 997 + r * 131 + c * 17 + 7, 2654435761) >>> 0;\n        if (y + 14 + r * 24 > 820) continue;\n        out.push({ x: x + 8 + c * 16, y: y + 14 + r * 24, on: h % 5 < 2, blink: h % 97 === 3 });\n      }\n    }\n  });\n  return { towers, out };\n}\n\nconst city = windows();\n\nexport function CinemaApertureOpen({\n  kicker = \"A film by Rafa Moreno\",\n  title = \"Glass Harbor\",\n  subtitle = \"Premiere screening · Friday, 9:00 PM · Screen 2\",\n  cta = { label: \"Reserve seats\", href: \"#\" },\n  blades = 9,\n  autoPlay = true,\n  open,\n  defaultOpen = false,\n  onOpenChange,\n  accent = \"#ff5fa2\",\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: CinemaApertureOpenProps) {\n  const Heading = headingAs;\n  const uid = React.useId().replace(/[^a-zA-Z0-9]/g, \"\");\n  const [innerOpen, setInnerOpen] = React.useState(defaultOpen);\n  const [manual, setManual] = React.useState(false);\n  const isOpen = open ?? innerOpen;\n  const [p, setP] = React.useState(defaultOpen ? 1 : 0);\n  const pRef = React.useRef(p);\n  const changeRef = React.useRef(onOpenChange);\n\n  React.useEffect(() => {\n    changeRef.current = onOpenChange;\n  }, [onOpenChange]);\n\n  React.useEffect(() => {\n    let raf = 0;\n    const from = pRef.current;\n    const to = isOpen ? 1 : 0;\n    const dur = isOpen ? 1700 : 1100;\n    let start = 0;\n    const step = (t: number) => {\n      if (!start) start = t;\n      const k = Math.min(1, (t - start) / dur);\n      const v = from + (to - from) * ease(k);\n      pRef.current = v;\n      setP(v);\n      if (k < 1) raf = requestAnimationFrame(step);\n    };\n    raf = requestAnimationFrame(step);\n    return () => cancelAnimationFrame(raf);\n  }, [isOpen]);\n\n  React.useEffect(() => {\n    if (!autoPlay || manual || open !== undefined) return;\n    const t = window.setTimeout(() => {\n      setInnerOpen((o) => !o);\n    }, innerOpen ? 5200 : 1300);\n    return () => window.clearTimeout(t);\n  }, [autoPlay, manual, open, innerOpen]);\n\n  const toggle = () => {\n    const next = !isOpen;\n    setManual(true);\n    if (open === undefined) setInnerOpen(next);\n    changeRef.current?.(next);\n  };\n\n  const n = Math.max(5, Math.min(14, Math.round(blades)));\n  const twist = 70;\n  const reach = 150;\n  const stopIndex = Math.round(p * (stops.length - 1));\n  const vars = { \"--hb-vc4-accent\": accent, \"--hb-vc4-p\": p.toFixed(3), ...style } as React.CSSProperties;\n\n  return (\n    <section className={[\"hb-vc4\", className].filter(Boolean).join(\" \")} style={vars} {...rest}>\n      <style href=\"hb-cinema-aperture-open\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vc4-scene\" aria-hidden=\"true\">\n        <svg viewBox=\"0 0 1600 900\" preserveAspectRatio=\"xMidYMid slice\">\n          <defs>\n            <linearGradient id={`hb-vc4-sky-${uid}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n              <stop offset=\"0\" stopColor=\"#0b0618\" />\n              <stop offset=\".45\" stopColor=\"#3a1240\" />\n              <stop offset=\".72\" stopColor=\"#c2456b\" />\n              <stop offset=\".86\" stopColor=\"#ff9a6a\" />\n              <stop offset=\"1\" stopColor=\"#1a0a14\" />\n            </linearGradient>\n            <linearGradient id={`hb-vc4-sea-${uid}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n              <stop offset=\"0\" stopColor=\"#2a0f28\" />\n              <stop offset=\"1\" stopColor=\"#05030a\" />\n            </linearGradient>\n          </defs>\n          <rect width=\"1600\" height=\"900\" fill={`url(#hb-vc4-sky-${uid})`} />\n          <circle cx=\"1080\" cy=\"560\" r=\"120\" fill=\"#ffd2a8\" opacity=\".5\" />\n          {city.towers.map(([x, y, w], i) => (\n            <rect key={i} x={x} y={y} width={w} height={820 - y} fill=\"#0d0714\" />\n          ))}\n          {city.out.map((wv, i) =>\n            wv.on ? (\n              <rect key={i} className={wv.blink ? \"hb-vc4-win\" : undefined} x={wv.x} y={wv.y} width=\"7\" height=\"10\" fill=\"#ffc78a\" opacity=\".78\" />\n            ) : null,\n          )}\n          <rect y=\"820\" width=\"1600\" height=\"80\" fill={`url(#hb-vc4-sea-${uid})`} />\n          {[0, 1, 2, 3, 4].map((i) => (\n            <rect key={i} x={1040 - i * 14} y={830 + i * 13} width={80 + i * 28} height=\"2\" fill=\"#ffc9a0\" opacity={(0.5 - i * 0.08).toFixed(2)} />\n          ))}\n        </svg>\n      </div>\n      <div className=\"hb-vc4-copy\">\n        {kicker ? <p className=\"hb-vc4-kicker\">{kicker}</p> : null}\n        <Heading className=\"hb-vc4-title\">{title}</Heading>\n        {subtitle ? <p className=\"hb-vc4-sub\">{subtitle}</p> : null}\n        {cta ? (\n          <a className=\"hb-vc4-cta\" href={cta.href} tabIndex={p < 0.5 ? -1 : undefined}>\n            {cta.label}\n            <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><path d=\"M3 8h10M9 4l4 4-4 4\" stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" /></svg>\n          </a>\n        ) : null}\n      </div>\n      <div className=\"hb-vc4-iris\" aria-hidden=\"true\">\n        <svg viewBox=\"-100 -100 200 200\" preserveAspectRatio=\"xMidYMid slice\">\n          <defs>\n            <linearGradient id={`hb-vc4-blade-${uid}`} x1=\"0\" y1=\"1\" x2=\"0\" y2=\"0\">\n              <stop offset=\"0\" stopColor=\"#2b2b30\" />\n              <stop offset=\".04\" stopColor=\"#141417\" />\n              <stop offset=\"1\" stopColor=\"#050506\" />\n            </linearGradient>\n            <radialGradient id={`hb-vc4-shade-${uid}`} cx=\"0\" cy=\"0\" r=\"1\" gradientUnits=\"userSpaceOnUse\" gradientTransform=\"scale(130)\">\n              <stop offset=\"0\" stopColor=\"#000\" stopOpacity=\"0\" />\n              <stop offset=\".55\" stopColor=\"#000\" stopOpacity=\"0\" />\n              <stop offset=\"1\" stopColor=\"#000\" stopOpacity=\".7\" />\n            </radialGradient>\n          </defs>\n          {Array.from({ length: n }, (_, i) => {\n            const rot = (i * 360) / n + twist * p;\n            const h = -6 + reach * p;\n            return (\n              <g key={i} transform={`rotate(${rot.toFixed(2)})`}>\n                <g transform={`translate(0 ${(-h).toFixed(2)})`}>\n                  <path d=\"M-400 -400 H400 V0 H-400Z\" fill={`url(#hb-vc4-blade-${uid})`} />\n                  <path d=\"M-400 0 H400\" stroke=\"#fff\" strokeOpacity=\".12\" strokeWidth=\".35\" />\n                  <path d=\"M-400 -.6 H400\" stroke=\"#000\" strokeOpacity=\".8\" strokeWidth=\".6\" />\n                </g>\n              </g>\n            );\n          })}\n          <rect x=\"-400\" y=\"-400\" width=\"800\" height=\"800\" fill={`url(#hb-vc4-shade-${uid})`} />\n        </svg>\n      </div>\n      <div className=\"hb-vc4-hud\" aria-hidden=\"true\">\n        <span className=\"hb-vc4-stop\">Aperture <b>f/{stops[stopIndex]}</b></span>\n        <span className=\"hb-vc4-ticks\">\n          {stops.map((s, i) => (\n            <span key={s} className=\"hb-vc4-tick\" data-on={i <= stopIndex ? \"true\" : \"false\"} />\n          ))}\n        </span>\n      </div>\n      <button type=\"button\" className=\"hb-vc4-ctrl\" onClick={toggle} aria-pressed={isOpen}>\n        {isOpen ? \"Close iris\" : \"Open iris\"}\n      </button>\n    </section>\n  );\n}\n"
    }
  ]
}