{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "transition-zoom-through",
  "type": "registry:component",
  "title": "Transition Zoom Through",
  "description": "The camera dives into a focal point: the first view rushes past and blurs out while the second grows into place from deep behind, with light streaks for speed. Switching back zooms out the same way.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "transitions",
    "zoom",
    "depth",
    "focus",
    "streaks",
    "transition"
  ],
  "docs": "https://hyperblur.dev/effects/transition-zoom-through",
  "files": [
    {
      "path": "registry/hyperblur/transition-zoom-through.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/transition-zoom-through.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface TransitionZoomThroughProps 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  depth?: number;\n  streaks?: boolean;\n  accent?: string;\n}\n\nconst css = `\n.hb-vj8 {\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: #030304;\n}\n.hb-vj8 *, .hb-vj8 *::before, .hb-vj8 *::after { box-sizing: border-box; }\n.hb-vj8-l {\n  grid-area: 1 / 1;\n  display: grid;\n  min-width: 0;\n  min-height: 0;\n  transform-origin: var(--hb-vj8-x) var(--hb-vj8-y);\n  transform: none;\n  opacity: 1;\n  filter: blur(0px);\n  transition:\n    transform calc(var(--hb-vj8-d) * 0.72) cubic-bezier(0.16, 1, 0.3, 1) calc(var(--hb-vj8-d) * 0.28),\n    opacity calc(var(--hb-vj8-d) * 0.5) cubic-bezier(0.16, 1, 0.3, 1) calc(var(--hb-vj8-d) * 0.28),\n    filter calc(var(--hb-vj8-d) * 0.6) ease calc(var(--hb-vj8-d) * 0.28),\n    visibility 0s linear 0s;\n}\n.hb-vj8-l[data-on=\"false\"] {\n  visibility: hidden;\n  opacity: 0;\n  filter: blur(10px);\n  transition:\n    transform calc(var(--hb-vj8-d) * 0.62) cubic-bezier(0.7, 0, 0.84, 0),\n    opacity calc(var(--hb-vj8-d) * 0.5) cubic-bezier(0.7, 0, 0.84, 0) calc(var(--hb-vj8-d) * 0.12),\n    filter calc(var(--hb-vj8-d) * 0.6) ease,\n    visibility 0s linear calc(var(--hb-vj8-d) * 0.62);\n}\n.hb-vj8[data-active=\"true\"] .hb-vj8-l[data-role=\"from\"] { transform: scale(var(--hb-vj8-k)); }\n.hb-vj8[data-active=\"true\"] .hb-vj8-l[data-role=\"to\"] { z-index: 1; }\n.hb-vj8[data-active=\"false\"] .hb-vj8-l[data-role=\"from\"] { z-index: 1; }\n.hb-vj8-l[data-role=\"to\"][data-on=\"false\"] { transform: scale(0.42); }\n.hb-vj8-fx {\n  position: absolute;\n  inset: -20%;\n  z-index: 2;\n  pointer-events: none;\n  opacity: 0;\n  background:\n    radial-gradient(circle at var(--hb-vj8-x) var(--hb-vj8-y), color-mix(in srgb, var(--hb-vj8-acc) 55%, #ffffff) 0, color-mix(in srgb, var(--hb-vj8-acc) 30%, transparent) 6%, transparent 22%),\n    repeating-conic-gradient(from 3deg at var(--hb-vj8-x) var(--hb-vj8-y), rgba(255, 255, 255, 0.5) 0deg 0.6deg, transparent 0.6deg 7deg, color-mix(in srgb, var(--hb-vj8-acc) 70%, transparent) 7deg 7.4deg, transparent 7.4deg 13deg);\n  -webkit-mask: radial-gradient(circle at var(--hb-vj8-x) var(--hb-vj8-y), transparent 8%, #000 30%, #000 60%, transparent 85%);\n  mask: radial-gradient(circle at var(--hb-vj8-x) var(--hb-vj8-y), transparent 8%, #000 30%, #000 60%, transparent 85%);\n  transform-origin: var(--hb-vj8-x) var(--hb-vj8-y);\n  mix-blend-mode: screen;\n}\n.hb-vj8[data-ran=\"true\"][data-active=\"true\"] .hb-vj8-fx { animation: hb-vj8-rush-a var(--hb-vj8-d) cubic-bezier(0.4, 0, 0.2, 1) both; }\n.hb-vj8[data-ran=\"true\"][data-active=\"false\"] .hb-vj8-fx { animation: hb-vj8-rush-b var(--hb-vj8-d) cubic-bezier(0.4, 0, 0.2, 1) both; }\n@keyframes hb-vj8-rush-a {\n  0% { opacity: 0; transform: scale(0.6) rotate(0deg); }\n  38% { opacity: 1; }\n  100% { opacity: 0; transform: scale(1.8) rotate(6deg); }\n}\n@keyframes hb-vj8-rush-b {\n  0% { opacity: 0; transform: scale(1.8) rotate(6deg); }\n  45% { opacity: 0.85; }\n  100% { opacity: 0; transform: scale(0.6) rotate(0deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vj8-l, .hb-vj8-l[data-on=\"false\"] { transition: none; }\n  .hb-vj8[data-ran=\"true\"] .hb-vj8-fx { animation: none; display: 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 TransitionZoomThrough({\n  children,\n  from,\n  to,\n  active,\n  defaultActive = false,\n  onActiveChange,\n  autoPlay = false,\n  interval = 2800,\n  duration = 1100,\n  origin = { x: 50, y: 50 },\n  depth = 3.2,\n  streaks = true,\n  accent = \"#7fb3ff\",\n  className,\n  style,\n  ...rest\n}: TransitionZoomThroughProps) {\n  const value = useSwap(active, defaultActive, onActiveChange, autoPlay, interval);\n  const [prev, setPrev] = React.useState(value);\n  const [ran, setRan] = React.useState(false);\n  if (prev !== value) {\n    setPrev(value);\n    setRan(true);\n  }\n  const kids = React.Children.toArray(children);\n  const a = from ?? kids[0] ?? <Scene tone=\"radial-gradient(circle at 50% 50%, #1b2440, #06070c 70%)\" kicker=\"Milky Way\" title=\"Orion arm\" />;\n  const b = to ?? kids[1] ?? <Scene tone=\"radial-gradient(circle at 50% 50%, #3a2a1a, #0b0805 70%)\" kicker=\"Kepler-452\" title=\"b, 1,402 light years\" />;\n\n  const vars = {\n    \"--hb-vj8-x\": `${origin.x}%`,\n    \"--hb-vj8-y\": `${origin.y}%`,\n    \"--hb-vj8-d\": `${duration}ms`,\n    \"--hb-vj8-k\": Math.max(1.2, depth).toFixed(2),\n    \"--hb-vj8-acc\": accent,\n  } as React.CSSProperties;\n\n  return (\n    <div className={[\"hb-vj8\", className].filter(Boolean).join(\" \")} style={{ ...vars, ...style }} data-active={value} data-ran={ran} {...rest}>\n      <style href=\"hb-transition-zoom-through\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vj8-l\" data-role=\"from\" data-on={!value} aria-hidden={value} inert={value}>{a}</div>\n      <div className=\"hb-vj8-l\" data-role=\"to\" data-on={value} aria-hidden={!value} inert={!value}>{b}</div>\n      {streaks ? <div className=\"hb-vj8-fx\" aria-hidden=\"true\" /> : null}\n    </div>\n  );\n}\n"
    }
  ]
}