# Inchworm

A looper in profile that moves by alternating anchors rather than a travelling wave. The body is a fixed length, so the arch height is solved from the anchor span: close the span and the loop has to rise.

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

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

## Notes

- The arch is solved, not drawn: a short bisection on the spine solver's turn finds the arc of the body's own length whose chord is the current anchor span. Shorten the span and the loop rises because there is nowhere else for the length to go.
- No travelling wave anywhere in it, which is what makes it different from every other crawler here. Exactly one end is ever off the surface.
- The animal walks on the spot and the surface marks slide under it, the same convention the conveyor and the rover use. There is no ground friction or adhesion model.

## Usage

```tsx
import { RobotInchworm } from "@/components/ui/robot-inchworm"

<RobotInchworm behavior="loop" />

// Or drive the span and the reach yourself.
<RobotInchworm phase={0.35} span={0.2} reach={0.7} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One crawler, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"loop" | "rear" | "measure" | "static"` | `"loop"` | What it does when phase is not supplied: anchor, arch, reach and draw up; hold the front end up and cast about; or pace the same loop out slowly. |
| `phase` | `number` | — | Controlled cycle fraction. Supplying it stops the internal clock. |
| `speed` | `number` | `0.4` | Loops per second. |
| `offset` | `number` | `0` | Seconds of offset, so a row 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. |
| `span` | `number` | — | Anchor separation, 0 drawn right up to 1 stretched out. Omit and the behavior sets it. |
| `reach` | `number` | — | How far the front end is lifted off the surface, 0–1. Omit and the behavior decides. |
| `segments` | `number` | `14` | Links in the body, clamped to 3–24. |
| `interactive` | `boolean` | `true` | The front end lifts toward the pointer, and a click rears it right up. |
| `onRear` | `() => void` | — | Fired on the click that rears it up. |
| `showGround` | `boolean` | `true` | The surface, and the marks that show it travelling over it. |
| `label` | `string` | — | Caption underneath the crawler. |
| `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-inchworm.tsx`
