# Bear

The quadruped that stands up. Its soles are segments on the floor rather than points, so the four of them union into a base of support with edges — and rearing collapses that base to two while taking the centre of mass out over it. The balance rule slides the body back until the margin is positive again; the shoulder hump is an output of what the forelimbs carry.

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

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

## Notes

- Every foot is a rigid heel-to-toe sole placed on the floor by solveSole, with the leg solved to the ankle that placement produces rather than the other way round. A flat sole is an interval, a rolling one is a point, and a sole that cannot reach the floor reports itself airborne instead of pretending to stand.
- rear is a rigid rotation of the whole solved body about its hip, so every link length survives it exactly — and it is the base of support, not the drawing, that decides whether the pose stands up. With balance at 0 and a full rear the centre of mass leaves the base, the support marker goes red and the machine is drawn toppling, because that is what that pose is.
- The balance rule is proportional and has no gain, no lag and no fall recovery: it slides the body along the floor until the centre of mass sits at the middle of whatever base the feet are making, clamped to 22 units of travel.
- The hump is derived from the forelimb load, so it swells under each forelimb's stance and goes flat in a rear. Supplying hump overrides the mechanism with a shape.
- Illustrative kinematics with a static weight distribution on top: no acceleration, no ground reaction force, no centre of pressure, no impulse at footfall. Fur, pelage and claws are drawn, not solved, and the animal does not travel across its frame while its feet move.

## Usage

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

<RobotBear behavior="amble" />

// Or stand it up yourself and watch the balance rule keep the margin.
<RobotBear rear={1} balance={1} 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` | `"amble" | "rear" | "forage" | "static"` | `"amble"` | What it does when nothing is driving it: the lateral-sequence plantigrade walk, a rise onto the hind soles and back down, head-down foraging with a working forepaw, or standing square. |
| `phase` | `number` | — | Controlled stride fraction. Supplying it stops the internal clock. |
| `speed` | `number` | `0.4` | Strides, or rises, 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. |
| `rear` | `number` | — | 0 on four soles to 1 standing on the hind pair. Omit and the behavior works it; drag it with the pointer. |
| `balance` | `number` | — | How much of the body's carriage the balance rule takes, 0 scripted to 1 derived. At 1 the standing pose is wherever the arithmetic had to put the body to keep the centre of mass over the soles. |
| `arch` | `number` | — | Back curvature, −1 hollowed to 1 roached. Restrained, because a bear holds a topline. |
| `crouch` | `number` | — | Leg fold, 0 standing tall to 1 down on the hocks. Omit and the behavior decides. |
| `hump` | `number` | — | Hump height in world units. Omit and the load on the forelimbs drives it. |
| `dig` | `number` | — | How hard the near forepaw rakes the floor, 0–1. |
| `ears` | `number` | — | Ears, −1 flattened back to 1 pricked. Omit and the behavior sets them. |
| `gaze` | `number` | — | Head and eye aim, −1..1. Omit and it follows the pointer. |
| `interactive` | `boolean` | `true` | Drag up and down to rear it, arrows for 10% (25% with shift), Home and End at either end. The head tracks the pointer. |
| `onRearChange` | `(rear: number) => void` | — | Fired while a person is rearing it by hand. |
| `showGround` | `boolean` | `true` | The ground line and the shadow, which shrinks as it stands up. |
| `showContacts` | `boolean` | `false` | Mark each grounded sole, shaded by the share of the weight it carries. |
| `showSupport` | `boolean` | `false` | Draw the base of support, the centre of mass on its plumb line, and the margin between them. It goes red when the margin is negative. |
| `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-bear.tsx`
