Installation
$ pnpm dlx shadcn@latest add https://shadercn.vercel.app/r/orb-02.json
Usage
import { Orb02 } from "@/components/orbs/orb-02";<Orb02 size={280} state="idle" />Props
Component Props
| Prop | Type | Default | Description |
|---|---|---|---|
state | "idle" | "thinking" | "speaking" | "idle" | Drive preset the orb eases toward |
size | number | 280 | Rendered size in CSS pixels |
params | Partial<Record<string, number>> | - | Shader param overrides, see Shader Props |
colors | Partial<Record<string, string>> | - | Shader colour overrides as hex strings |
statePresets | Partial<Record<OrbState, Record<string, number>>> | - | Replace the built-in per-state param presets |
stateColors | Partial<Record<OrbState, Record<string, string>>> | - | Replace the built-in per-state colours |
stateVolumes | Partial<Record<OrbState, { input?: number; output?: number }>> | - | Pin the drive volumes a state settles on |
volumes | { input?: number; output?: number } | - | Drive the orb directly, bypassing synthesis |
paused | boolean | false | Freeze the frame loop |
pauseOffscreen | boolean | true | Stop rendering while scrolled out of view |
maxDpr | number | 2 | Upper bound on the device pixel ratio |
className | string | - | Class on the wrapper element |
style | CSSProperties | - | Inline style on the wrapper element |
ariaLabel | string | - | Accessible name for the canvas |
Shader Props
Pass any of these through params; each is a single f32 uniform read by the shader.
| Param | Label | Range | Step | Default |
|---|---|---|---|---|
speed | Anim speed | 0.015 – 10 | 0.05 | 0.5 |
swirl | Swirl | 0 – 3 | 0.015 | 0.06 |
radius | Radius | 0.15 – 3 | 0.015 | 0.9 |
swell | Input swell | 0 – 1 | 0.01 | 0.06 |
zoom | Pattern zoom | 0.15 – 40 | 0.2 | 4.4 |
bulge | Sphere bulge | 0 – 10 | 0.05 | 0.35 |
warpFreq | Warp frequency | 0.05 – 10 | 0.05 | 1.5 |
hueShift | Hue shift | 0 – 6.283 | 0.05 | 0 |
coreClamp | Flare size | 0.003 – 3 | 0.015 | 0.12 |
falloff | Fill | 0.05 – 4 | 0.05 | 1 |
gain | Exposure | 0.015 – 10 | 0.05 | 0.55 |
rim | Rim light | 0 – 3 | 0.015 | 0.12 |
rimPow | Rim tightness | 0.15 – 15 | 0.1 | 2.2 |
alphaGain | Alpha gain | 0.05 – 15 | 0.1 | 2.4 |
baseVis | Base visibility | 0 – 1.5 | 0.01 | 0.08 |
Credits
Shader by XorDev, ported from orbkit (WebGL/GLSL) to WebGPU/WGSL.