# Fish

A swimming fish in profile. The hull is a travelling body wave offset to either side, with the swing piled at the tail, fins that work, and a dart you can set off.

> For the complete index, see [llms.txt](https://robocn.dev/llms.txt). A Markdown version of any page is available by appending `.md` to its URL or by sending an `Accept: text/markdown` header.

## Install

```bash
bunx --bun shadcn@latest add https://robocn.dev/r/robot-fish.json
```

Registry item: `robot-fish` · [`https://robocn.dev/r/robot-fish.json`](https://robocn.dev/r/robot-fish.json)

## Notes

- Side elevation is the drawing it always had. A hull is round in section: off-axis the body is a chain of tubes down the solved spine, each as thick as the hull is there.
- The hull is the solver's output: `spineOutline` offsets every solved joint by a width profile, so the silhouette cannot drift out of step with the wave.
- Body swing is tapered to the tail, which is what a carangiform swimmer does. Thrust, drag and buoyancy are not modelled — this is a pose, not a simulation.

## Usage

```tsx
import { RobotFish } from "@/components/ui/robot-fish"

<RobotFish behavior="cruise" />

// Or drive the beat from your own timeline.
<RobotFish phase={0.35} amplitude={0.7} waves={1.4} turn={0.3} fins={20} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One fish, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"cruise" | "dart" | "hover" | "static"` | `"cruise"` | What it does when phase is not supplied: a steady beat, burst-and-glide, or holding station on its fins. |
| `phase` | `number` | — | Controlled cycle fraction. Supplying it stops the internal clock. Wraps in both directions. |
| `speed` | `number` | `1.1` | Tail beats per second. |
| `offset` | `number` | `0` | Seconds of offset, so a shoal breaks step. Phase is the beat here, so the offset has its own name. |
| `animate` | `boolean` | `true` | Off parks the machine at phase and stops rendering. A reduced-motion preference does the same. |
| `paused` | `boolean` | `false` | Freeze where it stands. |
| `amplitude` | `number` | `0.5` | Peak body swing, clamped to 0–1, where 1 is 52° off the axis. Omit and the behavior sets it. |
| `waves` | `number` | `1.2` | Wave crests along the body, clamped to 0.25–3. |
| `turn` | `number` | — | Steady body curvature, −1 nose down to 1 nose up. Omit and it turns toward the pointer. |
| `segments` | `number` | `14` | Links in the body, rounded and clamped to 3–24. |
| `fins` | `number` | — | Pectoral fin angle in degrees, clamped to −45..45. Omit and the behavior works them. |
| `interactive` | `boolean` | `true` | Turns toward the pointer, and darts when clicked — a swing and speed spike that decays out. |
| `onDart` | `() => void` | — | Fired on the click that starts a dart. |
| `showGround` | `boolean` | `true` | The seabed line and its scatter. |
| `label` | `string` | — | Caption underneath the fish. |
| `variant` | `"solid" | "outline" | "blueprint" | "wire"` | `"solid"` | How the machine is painted. Geometry never changes between variants. |
| `size` | `"xs" | "sm" | "md" | "lg" | "xl" | number` | `"md"` | Rendered width in pixels, or a step on the scale. |
| `color` | `string` | `var(--robot-shell)` | Body panels — the colour the machine reads as. |
| `accent` | `string` | `var(--robot-accent)` | Status colour: tip light, live tool, readouts. |
| `metal` | `string` | `var(--robot-metal)` | Bare machined parts: collars, bolts, tool bodies. |
| `dark` | `string` | `var(--robot-dark)` | Cast joints, base, shadow side. |
| `palette` | `Partial<RobotPalette>` | — | Override any subset of roles at once, including glow and grid. |

## Source

- `src/components/ui/robot-fish.tsx`
