# Cargo plane

A high-wing freighter that banks because it was asked to turn. Give it a rate of turn and an airspeed and the bank is solved; the ailerons carry the roll it has not finished.

> 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/cargo-plane.json
```

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

## Notes

- Solved: the bank, from `coordinatedBank()`. A rate of turn at an airspeed fixes the radius, and a coordinated turn stands at atan(v²/rg) — so doubling the speed at the same radius asks for four times the tangent.
- The ailerons are not a second animation: they carry the difference between the bank the aircraft is holding and the one the turn asks for, so they return to neutral once the turn is established and never move in level flight.
- Illustrated: the wing is a flat plate and the propellers are drawn rather than solved. Nothing computes lift, drag, load factor or a stall, and the aircraft does not travel.

## Usage

```tsx
import { CargoPlane } from "@/components/ui/cargo-plane"

<CargoPlane behavior="circuit" engines={4} />

// The same commanded turn banks further at speed.
<CargoPlane turn={3} airspeed={160} view="front" />
<CargoPlane behavior="approach" />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"plan"` | Where the camera stands. One aircraft, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `turn` | `number` | — | Commanded rate of turn in degrees per second, positive to starboard, clamped to ±6. Omit it and the behaviour flies it. |
| `onTurnChange` | `(turn: number) => void` | — | The commanded rate, while a person is flying it. |
| `airspeed` | `number` | `110` | True airspeed in metres per second. The bank for a given rate of turn is not the same at every speed. |
| `configuration` | `number` | — | Flaps, gear and ramp together, 0 clean to 1 dirty. Omit it and the behaviour sets it. |
| `behavior` | `"cruise" | "circuit" | "approach" | "static"` | `"cruise"` | Hold a heading, fly rate-one turns each way, or come down dirty. |
| `engines` | `2 | 4` | `4` | Two engines or four, on the same wing. |
| `speed` | `number` | `0.2` | Turn cycles per second. |
| `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. |
| `phase` | `number` | `0` | Seconds of offset, so a row of machines breaks step. |
| `interactive` | `boolean` | `false` | Press and drag across the aircraft to command a turn; arrow keys change the rate half a degree per second at a time. |
| `showRamp` | `boolean` | `true` | The rear loading ramp, down at the dirty end of the configuration. |
| `active` | `boolean` | — | Light the navigation lamps and the beacon. |
| `label` | `string` | — | Caption underneath the aircraft. |
| `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/cargo-plane.tsx`
