# Stipple orb

A voice orb drawn as pen and ink stippling: a sphere of evenly spaced dots of one size, where only how close the dots sit makes the form. The dots travel to a new form for every voice state. A drop-in swap for the free voice orb.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Stipple orb. A sphere stippled in ink dots over the call controls. The dots migrate to a new form for every turn of the call: a pull to the centre while you talk, three turning rings while it thinks, the lit sphere again when it answers. Preview: https://chatcn.dev/preview/stipple-orb-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/stipple-orb
```

## Usage

```tsx
import { StippleOrb } from "@/components/ui/chatcn/pro/stipple-orb"

<StippleOrb state={voice.state} inputLevel={mic.getLevel} outputLevel={agent.getLevel} size="xl" />
```

Same props as `VoiceOrb`, so changing the import is the whole migration. Every state is a form, and every form is a set of homes, one per dot, relaxed so neighbours keep an even distance: idle is the lit sphere with its light drifting, connecting a lit ring that turns, listening gathers the dots toward the centre and breathes in with the user's voice, thinking parts them into three rings turning against each other, speaking returns to the lit sphere and swells every dot with the agent's voice, interrupted presses the sphere flat with one small jolt, muted spreads the dots evenly and quiet, and error leaves a ring broken at the lower right, in red.

On a state change each dot travels to its new home on a critically damped spring. Dots and homes are paired by angle and then by distance from the centre, so paths never cross, and the centre leaves first, so a form opens from the middle out. Pass `bands`, a getter of eight band energies from low to high, and speaking swells the bottom of the orb with low voices and the top with high ones. On a light ink (dark themes) the dots stand for light instead of shadow, so the sphere stays lit from the upper left in both themes.

## Examples

### States, sizes and reduced motion

Example: Stipple orb states. All eight voice states, the sizes and the still frames drawn under reduced motion. Preview: https://chatcn.dev/preview/stipple-orb-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `state` | `"idle" | "connecting" | "listening" | "thinking" | "speaking" | "interrupted" | "muted" | "error"` | Default `idle`. Same states as `VoiceOrb` |
| `level`, `inputLevel`, `outputLevel` | `number | () => number` | 0 to 1. Input drives listening, output drives speaking. A getter animates without re-rendering |
| `simulate` | `boolean` | Speech-like levels where none are passed, for demos |
| `size` | `"sm" | "md" | "lg" | "xl" | number` | 40, 72, 144, 224 px. Default `lg` |
| `renderer` | `"auto" | "webgl" | "2d"` | Accepted for the swap; the dots always draw with canvas 2D |
| `reducedMotion` | `boolean` | Force it on or off. Defaults to the user's setting |
| `label` | `string` | Accessible name. Default "Voice: listening" and so on |
| `ink` | `string` | Token or CSS color for the dots. Default `var(--chatcn-fg)` |
| `paused`, `defaultPaused`, `onPausedChange` | `boolean` | Controlled or uncontrolled pause |
| `pauseControl` | `boolean` | Show the pause button. Default on from 120 px |
| `dots` | `number` | Dot count. Default about one per 15 square px: 1,410 at 144 px |
| `bands` | `() => Float32Array` | Eight band energies, low to high, read once per frame |

## Keyboard

| Key | Action |
| --- | --- |
| `Tab`, `Enter` | Focus and toggle the pause button, when it shows |

## Accessibility

- One `role="img"` named by state, "Voice: speaking", exactly like the free voice orb. Announce state changes in your own live region, as the examples do.
- The canvas is `aria-hidden`; nothing animated is read out.
- Error uses the red token and the state label as its backup, never color alone.
- Under `forced-colors: active` the effect hides and a plain outline keeps the orb's place. Under `prefers-contrast: more` the marks snap to the text token.

## Motion

- Dots travel on critically damped springs, so nothing overshoots, and leave from the centre outward. Rings dissolve into the sphere from the middle out.
- The homes of each form are built once per size in idle time, in small steps, and shared by every orb of that size, so mounting never blocks. The current form builds first and the others follow, so the first change to each state migrates at once.
- Loops run on the shared frame clock at 30 fps and stop offscreen, in hidden tabs and when paused.
- Under reduced motion each state is one still frame: the lit sphere, the ring, the gathered sphere, the three rings, the swollen sphere, the pressed sphere, the quiet disc and the broken ring.

Source: https://chatcn.dev/docs/components/stipple-orb