# Dragonfly

A four-winged flyer from above. Fore and hind pairs beat half a cycle apart, which is what lets it hold station, and a beating wing is foreshortened by the cosine of its own stroke angle rather than redrawn.

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

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

## Notes

- Plan view is the identity projection. Off-axis the wings stand at their real stroke angle and the body is a chain of tubes — the two things the plan can only imply.
- Fore and hind wings carry a fixed half-cycle offset. That is the mechanism, not a decoration: it is what a dragonfly does instead of bobbing through every stroke.
- The wing plate is an illustrated membrane on a solved projection — the foreshortening is real, the venation is drawn. The abdomen is the spine solver.

## Usage

```tsx
import { RobotDragonfly } from "@/components/ui/robot-dragonfly"

<RobotDragonfly behavior="hover" />

// Or drive the beat, the yaw and the abdomen yourself.
<RobotDragonfly phase={0.25} swing={1} heading={-30} curl={0.5} altitude={0.8} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"plan"` | Where the camera stands. One flyer, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"hover" | "dart" | "perch" | "static"` | `"hover"` | What it does when phase is not supplied: hold station, burst about, or sit with the wings out and the abdomen hooked under. |
| `phase` | `number` | — | Controlled wingbeat fraction. Supplying it stops the internal clock. |
| `speed` | `number` | `4` | Wingbeats per second. |
| `offset` | `number` | `0` | Seconds of offset, so a swarm 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. |
| `swing` | `number` | — | Stroke amplitude, 0 wings held flat to 1 the full beat. Omit and the behavior sets it. |
| `curl` | `number` | — | Abdomen curl out of the wing plane, 0 straight to 1 hooked under. Omit and the behavior sets it. |
| `heading` | `number` | — | Body yaw in degrees, clamped to −70..70. Omit and it turns toward the pointer. |
| `altitude` | `number` | — | Height above the ground, 0–1. Omit and the behavior decides. |
| `segments` | `number` | `9` | Links in the abdomen, clamped to 3–24. |
| `interactive` | `boolean` | `true` | It yaws toward the pointer, and a click sends it off in a dart that decays. |
| `onDart` | `() => void` | — | Fired on the click that starts a dart. |
| `showGround` | `boolean` | `true` | The ground shadow, and the reed it perches on. |
| `label` | `string` | — | Caption underneath the flyer. |
| `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-dragonfly.tsx`
