crucıble

Sonar

Phosphor radar scope: a rotating sweep beam with a soft angular-gradient afterglow over concentric range rings and faint azimuth spokes; seeded contacts blip awake when the beam crosses them, bloom, then decay — drifters leave breadcrumb tracks. Optional hud knob for the full instrument look. Canvas 2D, seeded, offscreen-paused, DPR-clamped, reduced-motion-safe.

canvasfree

Installation

CLI

npx shadcn@latest add @crucible/sonar

Props

PropTypeDefaultDescription
colors[string, string]["#34d399", "#04140c"]Two tones [phosphor, background]. phosphor colors the sweep beam, range rings, spokes and contact blips; background is the scope glass the whole instrument sits on. Defaults to classic phosphor green on near-black — pass amber (["#fbbf24", "#140e04"]) for a vintage CRT or ice blue for a naval console.
speednumber1Sweep-speed multiplier on top of period. 0 freezes the scope. 1 = default.
intensitynumber1Overall beam / blip / grid brightness, 0–2.
periodnumber6Seconds per full beam revolution (before speed). Clamped 2–60.
ringsnumber4Number of labeled range rings inside the scope circle. Clamped 1–12.
contactsnumber8Number of seeded contacts on the scope. Clamped 0–24.
persistencenumber0.55Phosphor persistence, 0–1 — how far around the dial the sweep's afterglow survives and how slowly contact blips decay between passes.
hudbooleanfalseFull instrument look: center crosshair + range-ring labels.
seednumber0x50a44e1dSeed for contact placement and drift — same seed, same scope picture.
dprnumber2devicePixelRatio ceiling. Clamped 1–2.
pausedbooleanfalseFreeze at the designed static frame (beam mid-sweep, two contacts lit).
Also accepts all props of React.ComponentPropsWithoutRef<"div">they pass through to the underlying element.

Honors prefers-reduced-motion with a designed static fallback, pauses offscreen and on hidden tabs, and passes className through.