{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "transition-iris-wipe",
  "type": "registry:component",
  "title": "Transition Iris Wipe",
  "description": "A film-style iris that closes on the first view to a single point, holds on black for a beat, then opens on the second. A lit ring rides the aperture edge and the closing view sinks back as it goes.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "transitions",
    "iris",
    "film",
    "clip-path",
    "two views",
    "transition"
  ],
  "docs": "https://hyperblur.dev/effects/transition-iris-wipe",
  "files": [
    {
      "path": "registry/hyperblur/transition-iris-wipe.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/transition-iris-wipe.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface TransitionIrisWipeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n  children?: React.ReactNode;\n  from?: React.ReactNode;\n  to?: React.ReactNode;\n  active?: boolean;\n  defaultActive?: boolean;\n  onActiveChange?: (active: boolean) => void;\n  autoPlay?: boolean;\n  interval?: number;\n  duration?: number;\n  origin?: { x: number; y: number };\n  accent?: string;\n  backdrop?: string;\n}\n\nconst css = `\n@property --hb-vj1-r {\n  syntax: \"<length>\";\n  inherits: true;\n  initial-value: 0px;\n}\n.hb-vj1 {\n  position: relative;\n  display: grid;\n  grid-template: minmax(0, 1fr) / minmax(0, 1fr);\n  overflow: hidden;\n  isolation: isolate;\n  box-sizing: border-box;\n  font-family: inherit;\n  background: var(--hb-vj1-bg);\n  --hb-vj1-max: 1200px;\n}\n.hb-vj1 *, .hb-vj1 *::before, .hb-vj1 *::after { box-sizing: border-box; }\n.hb-vj1-bd {\n  position: absolute;\n  inset: 0;\n  z-index: 0;\n  pointer-events: none;\n  background:\n    radial-gradient(circle at var(--hb-vj1-x) var(--hb-vj1-y), var(--hb-vj1-acc) 0 2px, transparent 2.5px),\n    radial-gradient(circle at var(--hb-vj1-x) var(--hb-vj1-y), transparent 0 13px, color-mix(in srgb, var(--hb-vj1-acc) 55%, transparent) 13.5px 14.5px, transparent 15px),\n    repeating-radial-gradient(circle at var(--hb-vj1-x) var(--hb-vj1-y), rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 34px);\n}\n.hb-vj1-l {\n  grid-area: 1 / 1;\n  position: relative;\n  z-index: 1;\n  display: grid;\n  min-width: 0;\n  min-height: 0;\n  --hb-vj1-r: var(--hb-vj1-max);\n  clip-path: circle(var(--hb-vj1-r) at var(--hb-vj1-x) var(--hb-vj1-y));\n  transition: --hb-vj1-r calc(var(--hb-vj1-d) * 0.5) cubic-bezier(0.22, 1, 0.36, 1) calc(var(--hb-vj1-d) * 0.5);\n}\n.hb-vj1-l::after {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  pointer-events: none;\n  background: radial-gradient(\n    circle at var(--hb-vj1-x) var(--hb-vj1-y),\n    transparent calc(var(--hb-vj1-r) - 26px),\n    color-mix(in srgb, var(--hb-vj1-acc) 16%, transparent) calc(var(--hb-vj1-r) - 3px),\n    color-mix(in srgb, var(--hb-vj1-acc) 85%, #ffffff) calc(var(--hb-vj1-r) - 1.5px),\n    var(--hb-vj1-acc) var(--hb-vj1-r),\n    transparent calc(var(--hb-vj1-r) + 0.5px)\n  );\n}\n.hb-vj1-in {\n  display: grid;\n  min-width: 0;\n  min-height: 0;\n  transform-origin: var(--hb-vj1-x) var(--hb-vj1-y);\n  transition: transform calc(var(--hb-vj1-d) * 0.5) cubic-bezier(0.22, 1, 0.36, 1) calc(var(--hb-vj1-d) * 0.5), filter calc(var(--hb-vj1-d) * 0.5) ease calc(var(--hb-vj1-d) * 0.5);\n}\n.hb-vj1-l[data-on=\"false\"] {\n  --hb-vj1-r: 0px;\n  transition: --hb-vj1-r calc(var(--hb-vj1-d) * 0.5) cubic-bezier(0.64, 0, 0.78, 0);\n}\n.hb-vj1-l[data-on=\"false\"] .hb-vj1-in {\n  transform: scale(0.9);\n  filter: brightness(0.55);\n  transition: transform calc(var(--hb-vj1-d) * 0.5) cubic-bezier(0.64, 0, 0.78, 0), filter calc(var(--hb-vj1-d) * 0.5) ease;\n}\n.hb-vj1-l[data-on=\"false\"][data-role=\"to\"] .hb-vj1-in { transform: scale(1.12); }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vj1-l, .hb-vj1-l[data-on=\"false\"], .hb-vj1-in, .hb-vj1-l[data-on=\"false\"] .hb-vj1-in { transition: none; }\n}\n`;\n\nfunction useSwap(\n  active: boolean | undefined,\n  defaultActive: boolean,\n  onActiveChange: ((active: boolean) => void) | undefined,\n  autoPlay: boolean,\n  interval: number,\n) {\n  const [inner, setInner] = React.useState(defaultActive);\n  const controlled = active !== undefined;\n  const value = controlled ? active : inner;\n  const set = React.useCallback(\n    (next: boolean) => {\n      if (!controlled) setInner(next);\n      onActiveChange?.(next);\n    },\n    [controlled, onActiveChange],\n  );\n  React.useEffect(() => {\n    if (!autoPlay) return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const id = window.setTimeout(() => set(!value), interval);\n    return () => window.clearTimeout(id);\n  }, [autoPlay, interval, value, set]);\n  return value;\n}\n\nfunction Scene({ tone, kicker, title }: { tone: string; kicker: string; title: string }) {\n  return (\n    <div style={{ display: \"grid\", alignContent: \"end\", gap: 4, padding: 20, minHeight: 180, background: tone, color: \"#ededed\" }}>\n      <span style={{ fontSize: 11, letterSpacing: \"0.14em\", textTransform: \"uppercase\", color: \"rgba(237,237,237,0.6)\" }}>{kicker}</span>\n      <strong style={{ fontSize: 20, fontWeight: 600, letterSpacing: \"-0.01em\" }}>{title}</strong>\n    </div>\n  );\n}\n\nexport function TransitionIrisWipe({\n  children,\n  from,\n  to,\n  active,\n  defaultActive = false,\n  onActiveChange,\n  autoPlay = false,\n  interval = 2800,\n  duration = 1200,\n  origin = { x: 50, y: 50 },\n  accent = \"#2f7bff\",\n  backdrop = \"#050506\",\n  className,\n  style,\n  ...rest\n}: TransitionIrisWipeProps) {\n  const ref = React.useRef<HTMLDivElement>(null);\n  const value = useSwap(active, defaultActive, onActiveChange, autoPlay, interval);\n  const kids = React.Children.toArray(children);\n  const a = from ?? kids[0] ?? <Scene tone=\"linear-gradient(160deg, #1d2a4a, #0c0f18)\" kicker=\"Chapter 1\" title=\"The harbor at dawn\" />;\n  const b = to ?? kids[1] ?? <Scene tone=\"linear-gradient(160deg, #3a1d2e, #120a10)\" kicker=\"Chapter 2\" title=\"Night shift\" />;\n  const { x, y } = origin;\n\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const update = () => {\n      const w = el.offsetWidth;\n      const h = el.offsetHeight;\n      const ox = (w * x) / 100;\n      const oy = (h * y) / 100;\n      const r = Math.hypot(Math.max(ox, w - ox), Math.max(oy, h - oy)) + 30;\n      el.style.setProperty(\"--hb-vj1-max\", `${r.toFixed(1)}px`);\n    };\n    update();\n    const ro = new ResizeObserver(update);\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, [x, y]);\n\n  const vars = {\n    \"--hb-vj1-x\": `${x}%`,\n    \"--hb-vj1-y\": `${y}%`,\n    \"--hb-vj1-d\": `${duration}ms`,\n    \"--hb-vj1-acc\": accent,\n    \"--hb-vj1-bg\": backdrop,\n  } as React.CSSProperties;\n\n  return (\n    <div ref={ref} className={[\"hb-vj1\", className].filter(Boolean).join(\" \")} style={{ ...vars, ...style }} data-active={value} {...rest}>\n      <style href=\"hb-transition-iris-wipe\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vj1-bd\" aria-hidden=\"true\" />\n      <div className=\"hb-vj1-l\" data-role=\"from\" data-on={!value} aria-hidden={value} inert={value}>\n        <div className=\"hb-vj1-in\">{a}</div>\n      </div>\n      <div className=\"hb-vj1-l\" data-role=\"to\" data-on={value} aria-hidden={!value} inert={!value}>\n        <div className=\"hb-vj1-in\">{b}</div>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}