{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "orb-web-construction",
  "title": "Orb Web Construction",
  "description": "A full-bleed hero background where a web builds in the real orb-weaver sequence: bridge, frame, radii laid hub-outward, a dashed scaffold spiral hub-outward, then a solid capture spiral laid outside-back-to-hub that visibly replaces the scaffold turn by turn. It then rests, tears a random sector, and rebuilds only that sector before resting again.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/loud/orb-web-construction/component.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\n\n// ---------------------------------------------------------------------------\n// OrbWebConstruction — a full-bleed hero background that builds a web in the\n// real orb-weaver sequence (Zschokke 1999): bridge/frame first, then radii\n// laid hub-outward, then a temporary non-sticky auxiliary spiral hub-outward\n// (structural scaffold, dashed), then the permanent sticky capture spiral\n// laid from the OUTSIDE back toward the hub, replacing the auxiliary spiral\n// turn by turn as it goes. Once finished, the web rests, a random sector\n// tears, and the SAME sequence (radii, then spiral) rebuilds only that\n// sector while the rest of the web stays put — real, documented orb-weaver\n// damage-repair behaviour.\n//\n// The auxiliary and capture spirals share one underlying curve\n// (spiralPoint(u), u=0 at hub .. u=1 at outer edge) so the \"replacement\" the\n// brief calls for reads as one spiral changing character (dashed -> solid)\n// rather than two visually distinct curves swapping — a boundary value\n// `uCap` marks how far in from the outer edge the capture silk has replaced\n// the scaffold; below it the segment renders dashed, at/above it solid.\n//\n// No pointer/keyboard interaction: this is a decorative full-bleed backdrop,\n// the canvas is aria-hidden, children render as ordinary DOM above it.\n// prefers-reduced-motion skips straight to the finished, mid-rest web (no\n// build sequence, no tear/repair cycle ever runs).\n// ---------------------------------------------------------------------------\n\nconst FRAME_ANCHORS = 3;\nconst FRAME_SEG_DUR = 0.4; // s, sequential\nconst FRAME_TOTAL = FRAME_ANCHORS * FRAME_SEG_DUR;\n\nconst RADII_STAGGER = 0.09; // s between spoke starts\nconst RADII_DRAW_DUR = 0.26; // s for one spoke to finish drawing\nconst RADII_JITTER_DEG = 4; // +/- per spoke\n\nconst AUX_DURATION = 2.1; // s, hub -> outer edge, dashed scaffold\nconst CAPTURE_DURATION = 3.1; // s, outer edge -> hub, solid capture silk\nconst SPIRAL_TURNS = 5.5; // shared by both aux and capture curves\n\nconst REST_MIN = 6;\nconst REST_MAX = 9;\nconst TEAR_DUR = 0.18; // s\nconst WEDGE_MIN_DEG = 40;\nconst WEDGE_MAX_DEG = 70;\n\nconst OUTER_FRACTION = 0.46; // outerRadius = min(w,h) * this\n\n// xorshift32 — deterministic across mounts, unlike Math.random, so the\n// resting frame this component ships doesn't drift screenshot to screenshot\nfunction makeRng(seed: number) {\n  let s = seed >>> 0 || 1;\n  return () => {\n    s ^= s << 13;\n    s ^= s >>> 17;\n    s ^= s << 5;\n    return ((s >>> 0) % 1_000_000) / 1_000_000;\n  };\n}\n\ntype RGB = [number, number, number];\n\nfunction parseHex(raw: string): RGB | null {\n  const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(raw.trim());\n  if (!m) return null;\n  let h = m[1];\n  if (h.length === 3) h = h.split(\"\").map((c) => c + c).join(\"\");\n  const n = parseInt(h, 16);\n  return [(n >> 16) & 255, (n >> 8) & 255, n & 255];\n}\n\nfunction rgba(c: RGB, a: number): string {\n  return `rgba(${c[0]}, ${c[1]}, ${c[2]}, ${a})`;\n}\n\nconst TAU = Math.PI * 2;\n\nfunction norm2pi(a: number): number {\n  let x = a % TAU;\n  if (x < 0) x += TAU;\n  return x;\n}\n\ninterface Radius {\n  angle: number; // radians, fixed at rebuild\n  progress: number; // 0..1 fraction drawn, updated per frame\n}\n\ninterface Wedge {\n  startDeg: number;\n  widthDeg: number;\n  indices: number[]; // radii indices whose angle falls inside the wedge\n  uCap: number; // 0..1, spiral replacement boundary local to this wedge\n}\n\nfunction angleInWedge(angleRad: number, w: Wedge): boolean {\n  const a = (norm2pi(angleRad) * 180) / Math.PI;\n  const start = ((w.startDeg % 360) + 360) % 360;\n  const end = start + w.widthDeg;\n  if (end <= 360) return a >= start && a <= end;\n  return a >= start || a <= end - 360;\n}\n\n// point on the shared aux/capture curve, u=0 at hub, u=1 at outer edge\nfunction spiralPoint(hubX: number, hubY: number, outerR: number, u: number): [number, number] {\n  const angle = u * SPIRAL_TURNS * TAU;\n  const r = u * outerR;\n  return [hubX + Math.cos(angle) * r, hubY + Math.sin(angle) * r];\n}\n\ntype Phase = \"frame\" | \"radii\" | \"aux\" | \"capture\" | \"rest\" | \"tear\" | \"repairRadii\" | \"repairSpiral\";\n\nexport interface OrbWebConstructionProps {\n  children?: React.ReactNode;\n  className?: string;\n  style?: React.CSSProperties;\n}\n\nexport function OrbWebConstruction({ children, className = \"\", style }: OrbWebConstructionProps) {\n  const wrapRef = useRef<HTMLDivElement | null>(null);\n  const canvasRef = useRef<HTMLCanvasElement | null>(null);\n\n  useEffect(() => {\n    const wrap = wrapRef.current;\n    const canvas = canvasRef.current;\n    if (!wrap || !canvas) return;\n    const ctx = canvas.getContext(\"2d\");\n    if (!ctx) return;\n\n    const mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    let reduced = mq.matches;\n\n    let cssW = 0;\n    let cssH = 0;\n    let dpr = 1;\n    let hubX = 0;\n    let hubY = 0;\n    let outerR = 0;\n\n    let rng = makeRng(0x51ffab1e);\n    let radii: Radius[] = [];\n    let n = 0;\n\n    let phase: Phase = \"frame\";\n    let phaseStart = 0; // seconds, same clock as `now`\n    let restDuration = REST_MIN;\n    let wedge: Wedge | null = null;\n    let capUCap = 1; // global capture boundary during the very first build only\n\n    // --- palette ------------------------------------------------------------\n    let foreground: RGB = [230, 230, 230];\n    let border: RGB = [58, 58, 58];\n    let isLight = false;\n    const readColors = () => {\n      const cs = getComputedStyle(document.documentElement);\n      foreground = parseHex(cs.getPropertyValue(\"--foreground\")) ?? foreground;\n      border = parseHex(cs.getPropertyValue(\"--border\")) ?? border;\n      isLight = !document.documentElement.classList.contains(\"dark\");\n    };\n    readColors();\n\n    // --- build/reset ----------------------------------------------------------\n    const resetCycle = () => {\n      n = Math.max(16, Math.min(28, Math.round(Math.min(cssW, cssH) / 60)));\n      rng = makeRng(0x51ffab1e);\n      radii = new Array(n).fill(0).map((_, i) => {\n        const base = (i / n) * TAU;\n        const jitter = ((rng() - 0.5) * 2 * RADII_JITTER_DEG * Math.PI) / 180;\n        return { angle: base + jitter, progress: 0 };\n      });\n      phase = \"frame\";\n      phaseStart = 0;\n      wedge = null;\n      capUCap = 1;\n    };\n\n    const pickWedge = (): Wedge => {\n      const startDeg = rng() * 360;\n      const widthDeg = WEDGE_MIN_DEG + rng() * (WEDGE_MAX_DEG - WEDGE_MIN_DEG);\n      const indices: number[] = [];\n      const probe: Wedge = { startDeg, widthDeg, indices, uCap: 0 };\n      for (let i = 0; i < radii.length; i++) {\n        if (angleInWedge(radii[i]!.angle, probe)) indices.push(i);\n      }\n      // never tear an empty wedge — widen until at least one spoke is caught\n      let guard = 0;\n      while (indices.length === 0 && guard < 8) {\n        probe.widthDeg += 15;\n        indices.length = 0;\n        for (let i = 0; i < radii.length; i++) {\n          if (angleInWedge(radii[i]!.angle, probe)) indices.push(i);\n        }\n        guard++;\n      }\n      return probe;\n    };\n\n    // --- phase advance --------------------------------------------------------\n    const advance = (now: number) => {\n      const elapsed = now - phaseStart;\n      switch (phase) {\n        case \"frame\":\n          if (elapsed >= FRAME_TOTAL) {\n            phase = \"radii\";\n            phaseStart = now;\n          }\n          break;\n        case \"radii\": {\n          const dur = n * RADII_STAGGER + RADII_DRAW_DUR;\n          if (elapsed >= dur) {\n            phase = \"aux\";\n            phaseStart = now;\n          }\n          break;\n        }\n        case \"aux\":\n          if (elapsed >= AUX_DURATION) {\n            phase = \"capture\";\n            phaseStart = now;\n            capUCap = 1;\n          }\n          break;\n        case \"capture\":\n          if (elapsed >= CAPTURE_DURATION) {\n            phase = \"rest\";\n            phaseStart = now;\n            capUCap = 0;\n            restDuration = REST_MIN + rng() * (REST_MAX - REST_MIN);\n          }\n          break;\n        case \"rest\":\n          if (elapsed >= restDuration) {\n            phase = \"tear\";\n            phaseStart = now;\n            wedge = pickWedge();\n            wedge.uCap = 0;\n          }\n          break;\n        case \"tear\":\n          if (elapsed >= TEAR_DUR) {\n            phase = \"repairRadii\";\n            phaseStart = now;\n          }\n          break;\n        case \"repairRadii\": {\n          const count = wedge ? wedge.indices.length : 0;\n          const dur = count * RADII_STAGGER + RADII_DRAW_DUR;\n          if (elapsed >= dur) {\n            phase = \"repairSpiral\";\n            phaseStart = now;\n          }\n          break;\n        }\n        case \"repairSpiral\": {\n          const widthDeg = wedge ? wedge.widthDeg : WEDGE_MIN_DEG;\n          const dur = Math.max(0.8, (AUX_DURATION + CAPTURE_DURATION) * (widthDeg / 360));\n          if (elapsed >= dur) {\n            phase = \"rest\";\n            phaseStart = now;\n            wedge = null;\n            restDuration = REST_MIN + rng() * (REST_MAX - REST_MIN);\n          }\n          break;\n        }\n      }\n    };\n\n    // --- per-frame state update (radii progress, wedge uCap) ------------------\n    const updateState = (now: number) => {\n      const elapsed = now - phaseStart;\n      if (phase === \"radii\") {\n        for (let i = 0; i < radii.length; i++) {\n          const start = i * RADII_STAGGER;\n          const p = Math.max(0, Math.min(1, (elapsed - start) / RADII_DRAW_DUR));\n          radii[i]!.progress = p;\n        }\n      } else if (phase === \"frame\") {\n        for (let i = 0; i < radii.length; i++) radii[i]!.progress = 0;\n      } else {\n        for (let i = 0; i < radii.length; i++) {\n          if (radii[i]!.progress < 1 && !(wedge && wedge.indices.includes(i))) radii[i]!.progress = 1;\n        }\n      }\n\n      if (phase === \"aux\") {\n        capUCap = 1; // nothing solid yet, only the growing dashed scaffold\n      } else if (phase === \"capture\") {\n        const p = Math.max(0, Math.min(1, elapsed / CAPTURE_DURATION));\n        capUCap = 1 - p;\n      }\n\n      if (wedge) {\n        if (phase === \"tear\") {\n          const p = Math.max(0, Math.min(1, elapsed / TEAR_DUR));\n          for (const i of wedge.indices) radii[i]!.progress = 1 - p;\n          wedge.uCap = p; // 0 (solid) -> 1 (erased)\n        } else if (phase === \"repairRadii\") {\n          for (let k = 0; k < wedge.indices.length; k++) {\n            const i = wedge.indices[k]!;\n            const start = k * RADII_STAGGER;\n            const p = Math.max(0, Math.min(1, (elapsed - start) / RADII_DRAW_DUR));\n            radii[i]!.progress = p;\n          }\n          wedge.uCap = 1; // spiral still fully absent in this wedge\n        } else if (phase === \"repairSpiral\") {\n          const widthDeg = wedge.widthDeg;\n          const dur = Math.max(0.8, (AUX_DURATION + CAPTURE_DURATION) * (widthDeg / 360));\n          const p = Math.max(0, Math.min(1, elapsed / dur));\n          wedge.uCap = 1 - p; // 1 (erased) -> 0 (rebuilt, solid)\n          for (const i of wedge.indices) radii[i]!.progress = 1;\n        }\n      }\n    };\n\n    // --- render -----------------------------------------------------------\n    // `t` throughout render/draw* is always seconds-since-mount (same clock\n    // advance()/updateState() use), never a raw performance.now() timestamp.\n    const auxGrowLimit = (t: number) => {\n      if (phase === \"aux\") return Math.max(0, Math.min(1, (t - phaseStart) / AUX_DURATION));\n      return 1;\n    };\n\n    const drawFrame = (elapsedInPhase: number, active: boolean) => {\n      const col = rgba(border, isLight ? 0.55 : 0.4);\n      ctx.strokeStyle = col;\n      ctx.lineWidth = 1;\n      ctx.setLineDash([]);\n      const pts: [number, number][] = [];\n      for (let i = 0; i < FRAME_ANCHORS; i++) {\n        const a = (i / FRAME_ANCHORS) * TAU - Math.PI / 2;\n        pts.push([hubX + Math.cos(a) * outerR, hubY + Math.sin(a) * outerR]);\n      }\n      for (let i = 0; i < FRAME_ANCHORS; i++) {\n        const segStart = i * FRAME_SEG_DUR;\n        const p = active ? Math.max(0, Math.min(1, (elapsedInPhase - segStart) / FRAME_SEG_DUR)) : 1;\n        if (p <= 0) continue;\n        const a = pts[i]!;\n        const b = pts[(i + 1) % FRAME_ANCHORS]!;\n        const x = a[0] + (b[0] - a[0]) * p;\n        const y = a[1] + (b[1] - a[1]) * p;\n        ctx.beginPath();\n        ctx.moveTo(a[0], a[1]);\n        ctx.lineTo(x, y);\n        ctx.stroke();\n      }\n    };\n\n    const drawRadii = () => {\n      ctx.strokeStyle = rgba(border, isLight ? 0.6 : 0.45);\n      ctx.lineWidth = 1;\n      ctx.setLineDash([]);\n      for (const r of radii) {\n        if (r.progress <= 0) continue;\n        const x = hubX + Math.cos(r.angle) * outerR * r.progress;\n        const y = hubY + Math.sin(r.angle) * outerR * r.progress;\n        ctx.beginPath();\n        ctx.moveTo(hubX, hubY);\n        ctx.lineTo(x, y);\n        ctx.stroke();\n      }\n    };\n\n    // draws the shared spiral curve, splitting each sample into dashed\n    // (not-yet-replaced scaffold) or solid (capture silk) runs, using the\n    // wedge's local uCap where the sample angle falls inside the active\n    // wedge and the global capUCap everywhere else.\n    const drawSpiral = (builtLimitU: number) => {\n      const steps = Math.max(60, Math.round(SPIRAL_TURNS * 48));\n      let prevSolid: boolean | null = null;\n      let path: [number, number][] = [];\n      const flush = (solid: boolean) => {\n        if (path.length < 2) {\n          path = [];\n          return;\n        }\n        ctx.strokeStyle = solid ? rgba(foreground, isLight ? 0.45 : 0.35) : rgba(border, isLight ? 0.55 : 0.4);\n        ctx.setLineDash(solid ? [] : [2, 3]);\n        ctx.lineWidth = solid ? 1.1 : 0.9;\n        ctx.beginPath();\n        ctx.moveTo(path[0]![0], path[0]![1]);\n        for (let k = 1; k < path.length; k++) ctx.lineTo(path[k]![0], path[k]![1]);\n        ctx.stroke();\n        path = [];\n      };\n      for (let s = 0; s <= steps; s++) {\n        const u = (s / steps) * builtLimitU;\n        if (u > builtLimitU) break;\n        const [x, y] = spiralPoint(hubX, hubY, outerR, u);\n        const angle = u * SPIRAL_TURNS * TAU;\n        const local = wedge && angleInWedge(angle, wedge) ? wedge.uCap : capUCap;\n        const solid = u >= local;\n        if (prevSolid !== null && prevSolid !== solid) {\n          path.push([x, y]);\n          flush(prevSolid);\n          path.push([x, y]);\n        } else {\n          path.push([x, y]);\n        }\n        prevSolid = solid;\n      }\n      if (prevSolid !== null) flush(prevSolid);\n      ctx.setLineDash([]);\n    };\n\n    const render = (t: number) => {\n      ctx.clearRect(0, 0, canvas.width, canvas.height);\n      ctx.save();\n      ctx.scale(dpr, dpr);\n\n      const framePhaseElapsed = phase === \"frame\" ? t - phaseStart : FRAME_TOTAL;\n      drawFrame(framePhaseElapsed, phase === \"frame\");\n\n      if (phase !== \"frame\") drawRadii();\n\n      if (phase === \"aux\") {\n        drawSpiral(auxGrowLimit(t));\n      } else if (phase !== \"frame\" && phase !== \"radii\") {\n        // capture / rest / tear / repair — full spiral extent, dashed vs\n        // solid decided per-sample inside drawSpiral via capUCap/wedge.uCap\n        drawSpiral(1);\n      }\n\n      ctx.restore();\n    };\n\n    // --- sizing -------------------------------------------------------------\n    const applyBacking = () => {\n      dpr = Math.min(window.devicePixelRatio || 1, 2);\n      canvas.width = Math.max(1, Math.round(cssW * dpr));\n      canvas.height = Math.max(1, Math.round(cssH * dpr));\n      canvas.style.width = `${cssW}px`;\n      canvas.style.height = `${cssH}px`;\n    };\n\n    let resizeTimer = 0;\n    let everSized = false;\n    const resize = () => {\n      const rect = wrap.getBoundingClientRect();\n      if (rect.width < 2 || rect.height < 2) return;\n      const changed = Math.abs(rect.width - cssW) > 0.5 || Math.abs(rect.height - cssH) > 0.5;\n      cssW = rect.width;\n      cssH = rect.height;\n      hubX = cssW / 2;\n      hubY = cssH / 2;\n      outerR = Math.min(cssW, cssH) * OUTER_FRACTION;\n      applyBacking();\n      if (changed && !everSized) {\n        // first real measurement — build and paint immediately, no debounce\n        everSized = true;\n        resetCycle();\n        if (reduced) primeReduced();\n        renderNow();\n      } else if (changed) {\n        window.clearTimeout(resizeTimer);\n        resizeTimer = window.setTimeout(() => {\n          resetCycle();\n          if (reduced) primeReduced();\n          renderNow();\n        }, 200);\n      } else {\n        renderNow();\n      }\n    };\n\n    const renderNow = () => render((performance.now() - mountClock) / 1000);\n\n    // reduced motion: run the phase machine forward synchronously in fixed\n    // small steps until the web is finished and sitting mid-rest, then paint\n    // that one static frame and never schedule another\n    const primeReduced = () => {\n      let t = 0;\n      const dt = 0.05;\n      const targetRestElapsed = 3; // land solidly inside \"rest\", not at its edge\n      let guard = 0;\n      while (guard < 4000) {\n        t += dt;\n        advance(t);\n        updateState(t);\n        if (phase === \"rest\" && t - phaseStart >= targetRestElapsed) break;\n        guard++;\n      }\n    };\n\n    // --- loop -----------------------------------------------------------\n    let raf = 0;\n    let visible = true;\n    let staticMode = reduced;\n    // fixed at first paint below, before resetCycle()/resize() run, so every\n    // renderNow() call (including the very first synchronous one) reads a\n    // consistent, small, near-zero `t` rather than a stale-vs-fresh mix\n    const mountClock = performance.now();\n\n    const loop = (now: number) => {\n      const t = (now - mountClock) / 1000;\n      advance(t);\n      updateState(t);\n      render(t);\n      if (visible && !document.hidden && !staticMode) {\n        raf = requestAnimationFrame(loop);\n      } else {\n        raf = 0;\n      }\n    };\n\n    const wake = () => {\n      if (raf || staticMode || !visible || document.hidden) return;\n      // mountClock stays fixed for the component's whole life — `t` is real\n      // elapsed wall time since mount, so a sleep period just means several\n      // pending phase transitions cascade through on the first few frames\n      // back, which is harmless since nobody was watching while asleep.\n      raf = requestAnimationFrame(loop);\n    };\n    const sleep = () => {\n      if (raf) cancelAnimationFrame(raf);\n      raf = 0;\n    };\n\n    const ro = new ResizeObserver(resize);\n    ro.observe(wrap);\n    resize(); // first real measurement runs resetCycle() itself, see above\n\n    const io = new IntersectionObserver(\n      (entries) => {\n        visible = entries.some((e) => e.isIntersecting);\n        if (visible) wake();\n        else sleep();\n      },\n      { threshold: 0 }\n    );\n    io.observe(wrap);\n\n    const onVis = () => {\n      if (document.hidden) sleep();\n      else wake();\n    };\n    document.addEventListener(\"visibilitychange\", onVis);\n\n    const applyMode = () => {\n      staticMode = reduced;\n      if (staticMode) {\n        sleep();\n        resetCycle();\n        primeReduced();\n        renderNow();\n      } else {\n        resetCycle();\n        wake();\n      }\n    };\n    const onMq = () => {\n      reduced = mq.matches;\n      applyMode();\n    };\n    mq.addEventListener(\"change\", onMq);\n\n    const themeObserver = new MutationObserver(() => {\n      readColors();\n      renderNow();\n    });\n    themeObserver.observe(document.documentElement, {\n      attributes: true,\n      attributeFilter: [\"class\"],\n    });\n\n    // resize()'s first-measurement branch above already primed and painted\n    // the initial frame (reduced or not) — only the live rAF loop is left\n    if (!reduced) raf = requestAnimationFrame(loop);\n\n    return () => {\n      sleep();\n      ro.disconnect();\n      io.disconnect();\n      themeObserver.disconnect();\n      mq.removeEventListener(\"change\", onMq);\n      document.removeEventListener(\"visibilitychange\", onVis);\n      window.clearTimeout(resizeTimer);\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n\n  return (\n    <div\n      ref={wrapRef}\n      className={`relative isolate h-full w-full overflow-hidden bg-background ${className}`}\n      style={style}\n    >\n      <canvas ref={canvasRef} aria-hidden=\"true\" className=\"absolute inset-0 block h-full w-full\" />\n      {children ? <div className=\"relative z-[1] h-full w-full\">{children}</div> : null}\n    </div>\n  );\n}\n\nOrbWebConstruction.displayName = \"OrbWebConstruction\";\n",
      "type": "registry:ui",
      "target": "components/ui/orb-web-construction.tsx"
    }
  ],
  "meta": {
    "collection": "loud",
    "tags": [
      "hero",
      "background",
      "canvas",
      "construction",
      "sequence",
      "monochrome",
      "ambient",
      "decorative",
      "organic",
      "repair"
    ],
    "instruction": "Build <OrbWebConstruction children? className? style?> as a full-bleed canvas hero background that lays down a web in the real orb-weaver construction order (Zschokke 1999), never a generic radial reveal. HUB at container center; outerRadius = min(w,h) * 0.46. PHASE 1 FRAME (1.2s total): three anchor threads at 120 degrees around outerRadius are drawn sequentially, 0.4s each, forming a triangle around the hub before anything else appears. PHASE 2 RADII: `n = clamp(round(min(w,h)/60), 16, 28)` spokes, evenly angled with +/-4deg per-spoke jitter, are drawn hub-to-outerRadius sequentially — one spoke starts every 90ms and takes 260ms to finish, so 2-3 are mid-draw at any moment; full radii phase takes roughly n*90ms+260ms. PHASE 3 AUXILIARY SPIRAL (2.1s): a dashed, low-alpha scaffold spiral grows from the hub outward along a shared curve `spiralPoint(u)` (u=0 hub, u=1 outer edge, angle = u*5.5 turns*2*PI, radius = u*outerRadius) — this is the SAME curve the capture spiral reuses in phase 4, so the 'replacement' reads as one spiral changing character rather than two different curves swapping. PHASE 4 CAPTURE SPIRAL (3.1s): a solid, brighter capture thread is laid from the OUTER edge (u=1) back toward the hub (u=0); a single scalar `uCap` (1 at capture-phase start, ramping to 0 over 3.1s) marks the boundary — samples along the shared curve with u>=uCap render solid (already replaced), samples with u<uCap render dashed (still original scaffold, not yet reached) — so the viewer watches the solid line eat the dashed one from the outside in, turn by turn. Once capture finishes the web rests fully built (uCap=0 everywhere) for a randomized 6-9s. TEAR: a random 40-70deg wedge is picked (widened in 15deg steps if it happens to catch zero spokes) and every spoke + spiral segment inside it erases over 180ms (spoke progress and a wedge-local uCap both ramp from built to erased in that window) while the rest of the web stays fully intact and static throughout. REPAIR: the SAME sequence (radii, then spiral) rebuilds ONLY the torn wedge — its spokes redraw staggered 90ms/260ms as in phase 2, then a wedge-local uCap ramps from 1 (erased) back to 0 (solid) over max(0.8s, (2.1+3.1)*wedgeWidthDeg/360) — while every spoke and spiral segment outside the wedge is untouched the entire time. After repair the web rests again, then tears a fresh random wedge, indefinitely (full cycle after the first build is roughly 9-13s: 6-9s rest + 0.18s tear + ~1-3s repair-radii + ~1-2s repair-spiral). All phase timing runs off a single continuous seconds-since-mount clock (`t`), never a per-frame delta accumulator, so phase transitions stay correct across variable frame rates and even across an off-screen sleep (IntersectionObserver/visibilitychange pause the rAF loop entirely; on wake, any backlog of phase transitions the wall clock accrued cascades through in the next few frames, which is inaudible/invisible since nobody was watching while paused). Every random choice (spoke jitter, wedge angle/width, rest duration) is driven by a deterministic xorshift32 PRNG seeded once per build, not Math.random, so the shipped resting frame is reproducible mount to mount. RENDER: capture-spiral solid segments use --foreground at ~0.35 alpha (dark) / ~0.45 alpha (light, where the token's contrast against --background compresses); frame threads, radii and dashed scaffold segments use --border at ~0.4 (dark) / ~0.55 (light) alpha; both colours are read via getComputedStyle(document.documentElement) at mount and re-read on a documentElement class MutationObserver, and light-vs-dark is decided from `document.documentElement.classList.contains('dark')`. ResizeObserver rebuilds the whole web (radii angles, hub position, outer radius, phase reset to the beginning) on a real size change, debounced 200ms except the very first real measurement which builds and paints immediately with no debounce; IntersectionObserver (threshold 0) and visibilitychange pause the single rAF loop off-screen or in a hidden tab. prefers-reduced-motion runs the identical phase-advance function synchronously in 50ms steps at mount (and after any resize) until the web lands solidly inside its first post-build rest window (3s into rest, well clear of the following tear), then paints exactly that one static, fully-built, undamaged frame and never schedules a rAF loop; a live change to the media query re-primes and re-freezes the same way. The canvas is aria-hidden with pointer-events implicitly none via absolute inset-0 with no listeners; children render as ordinary, independently focusable DOM above it. autoplay.mode is 'none' because the web animates entirely on its own internal clock with zero pointer/scroll/press dependency."
  },
  "type": "registry:ui"
}