# Spider

An eight-legged walker from above, with every knee solved in its own vertical plane. Tripod, wave and ripple gaits, and a body that turns to face where it is going.

> 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-spider.json
```

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

## Notes

- Plan view is the identity projection, facing included. The gait solver already works in three dimensions, so off-axis the legs are simply the solve drawn at the knee heights and foot clearances the plan view could only hint at by sliding them up the screen.
- Stance is pulled in far enough that a full stride still lands inside each leg's reach, so no requested foot is ever out of range.
- The view is plan: raised knees and swinging feet are offset up the screen in proportion to their solved height, which is a depth cue rather than a projection. The leg lengths themselves are solved.

## Usage

```tsx
import { RobotSpider } from "@/components/ui/robot-spider"

<RobotSpider behavior="walk" />

// Or drive the cycle and the facing yourself.
<RobotSpider gait="ripple" phase={0.3} heading={40} height={0.7} legs={6} showContacts />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"plan"` | Where the camera stands. One walker, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"walk" | "skitter" | "idle" | "static"` | `"walk"` | What it does when phase is not supplied: a tripod walk, a fast ripple, or standing and breathing. |
| `gait` | `"stand" | "tripod" | "wave" | "ripple"` | — | Footfall pattern. Omit and the behavior picks one. |
| `phase` | `number` | — | Controlled cycle fraction. Supplying it stops the internal clock. Wraps in both directions. |
| `speed` | `number` | `0.9` | Gait cycles per second. |
| `offset` | `number` | `0` | Seconds of offset, so a nest of them breaks step. |
| `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. |
| `legs` | `number` | `8` | Legs, rounded to an even number and clamped to 4–10. |
| `height` | `number` | `0.55` | Normalized body clearance, clamped to 0–1 (8–30 world units). |
| `stride` | `number` | `0.65` | Normalized foot travel, clamped to 0–1. Zero steps in place. |
| `lift` | `number` | `0.5` | Normalized swing height, clamped to 0–1. |
| `heading` | `number` | — | Facing in degrees, clockwise from up. Omit and it turns toward the pointer. |
| `interactive` | `boolean` | `true` | It faces the pointer and walks while it is watched; a click drops it into a crouch and another stands it up. |
| `onCrouchChange` | `(crouched: boolean) => void` | — | Fired when a click changes the crouch. |
| `showGround` | `boolean` | `true` | The ground patch under the machine; blueprint adds its grid. |
| `showContacts` | `boolean` | `false` | Ring the feet carrying weight. |
| `label` | `string` | — | Caption underneath the robot. |
| `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-spider.tsx`
