# Engraved orb

A voice orb drawn like a banknote engraving: a sphere made only of parallel lines that swell where the form is dark, thin out where it is lit, and swell again with the voice. 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: Engraved orb. A sphere drawn like a banknote engraving over the call controls. The lines swell with a simulated voice as the call moves through listening, thinking and speaking. Preview: https://chatcn.dev/preview/engraved-orb-demo

## Installation

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

## Usage

```tsx
import { EngravedOrb } from "@/components/ui/chatcn/pro/engraved-orb"

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

Same props as `VoiceOrb`, so changing the import is the whole migration. The lines run like latitudes seen from a little above, so they curve around the ball; their width is the shadow under them, with a second set of lines crossing the core shadow. Idle lets the light drift, connecting cuts the lines in one by one from the top, listening sends a ripple down them with the user's voice, thinking turns them into a slowly turning rosette, speaking swells them with the agent's voice, interrupted snaps them flat, muted draws them thin and even, and error prints them a second time in red, misregistered, like a misprint.

Pass `bands`, a getter of eight band energies from low to high, and speaking moves the lower lines with low voices and the upper lines with high ones. Without it every line follows the output level. On a light ink (dark themes) the plate prints as white lines on black, which swell in the light, so the sphere stays lit from the upper left in both themes.

## Examples

### States, sizes and reduced motion

Example: Engraved orb states. All eight voice states, the four sizes and the still frames drawn under reduced motion. Preview: https://chatcn.dev/preview/engraved-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"` | `auto` uses the shared WebGL2 context, then canvas 2D. `canvas` and `svg` are accepted as aliases of `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 lines. Default `var(--chatcn-fg)` |
| `paused`, `defaultPaused`, `onPausedChange` | `boolean` | Controlled or uncontrolled pause |
| `pauseControl` | `boolean` | Show the pause button. Default on from 120 px |
| `lines` | `number` | Lines across the sphere. Default 9, 14, 22 or 30 by size |
| `cross` | `boolean` | Cross hatch the core shadow. Default true |
| `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

- Every state blends into the next over 400 ms. The rosette spreads from the centre, cutting rings in as the lines thin away behind it, so it never cuts.
- Line coverage is filtered against the line field per pixel, so curves stay smooth and lines that crowd at the limb settle to an even gray instead of moiré, at any pixel ratio.
- 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 light at rest, half the lines drawn, swollen lines, the rosette, flat lines, thin lines, and both prints for error.

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