# Polar bear

The same plantigrade chassis with a second support system. swim hands the load from the soles to the water in one number: the base of support stops mattering, the hull settles to its waterline, the hind limbs trail, and the forelimbs paddle on a stroke path their two links are solved to.

> 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-polar-bear.json
```

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

## Notes

- swim is one number with four consequences, all arithmetic: legLoad(i) = (1 − swim) · supportLoad(i) and buoyancy = swim, so the soles unload; the hull rises to its draft at the waterline; the hind limbs stop stepping and trail; and the forelimbs cross over from standing to paddling.
- The stroke is a path and the limb is an output of it: the paw traces a closed loop that pulls deep and recovers shallow, and solveChain2 produces the shoulder and elbow from wherever on it the paw is. polarStroke is exported as a pure function of the beat, and the path itself is drawn while swimming.
- Buoyancy is a prop, not a computed displacement. There is no hydrodynamics of any kind: the stroke makes no thrust, the hull has no drag, and the draft is a constant rather than a function of what is submerged.
- Everything the bear says about its soles holds here too — the sole is rigid, the contact is read off the geometry, and the loads are a static distribution rather than a dynamics solve.

## Usage

```tsx
import { RobotPolarBear } from "@/components/ui/robot-polar-bear"

<RobotPolarBear behavior="swim" />

// Or work the handover yourself: half in, half out.
<RobotPolarBear swim={0.5} showContacts showSupport />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One animal, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"plod" | "swim" | "stalk" | "rear" | "static"` | `"swim"` | What it does when nothing is driving it: afloat with the forelimbs alternating, the plantigrade walk, a long low creep with the neck below the shoulder, a rise onto the hind soles, or standing square. |
| `phase` | `number` | — | Controlled stride, or stroke, fraction. Supplying it stops the internal clock. |
| `speed` | `number` | `0.45` | Strides, or strokes, per second. |
| `offset` | `number` | `0` | Seconds of offset, so a pair 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. |
| `swim` | `number` | — | 0 on the floor to 1 afloat — the handover. Omit and the behavior works it; drag it with the pointer. |
| `strokes` | `number` | `1` | Forelimb strokes per cycle, clamped 0.25–4. The two sides run half a cycle apart. |
| `rear` | `number` | — | 0 on four soles to 1 up on the hind pair. Scaled out by swim: nothing rears in the water. |
| `balance` | `number` | — | How much of the carriage the balance rule takes, 0 scripted to 1 derived. |
| `arch` | `number` | — | Back curvature, −1 hollowed to 1 roached. |
| `crouch` | `number` | — | Leg fold, 0 standing tall to 1 down on the hocks. |
| `neck` | `number` | — | Neck carriage, −1 run right down below the shoulder to 1 held high. The long neck is this animal's signature, so it is its own axis. |
| `gaze` | `number` | — | Head and eye aim, −1..1. Omit and it follows the pointer. |
| `interactive` | `boolean` | `true` | Drag up and down to work the handover, arrows for 10% (25% with shift), Home on the floor and End in the water. |
| `onSwimChange` | `(swim: number) => void` | — | Fired while a person is working the handover by hand. |
| `showGround` | `boolean` | `true` | The ground line and the shadow, which fades out as the water takes the weight. |
| `showContacts` | `boolean` | `false` | Mark each grounded sole, shaded by the share of the weight it still carries. |
| `showSupport` | `boolean` | `false` | Draw the base of support, the centre of mass, and the margin between them. |
| `label` | `string` | — | Caption underneath the animal. |
| `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-polar-bear.tsx`
