# Soccer ball

A truncated icosahedron inflated onto the sphere: twelve pentagons and twenty hexagons built from the solid, culled by their own normals, and rolled without slipping so the panels turn because it travelled.

> 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-soccer-ball.json
```

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

## Notes

- Solved: the ball itself. Truncating a regular icosahedron at exactly a third of every edge puts all sixty vertices the same distance from the centre, which is what makes the Archimedean solid; pushed onto the sphere and subdivided along great circles, the panels bulge the way an inflated one's do. Each carries its own normal, so the far side is culled and a panel over the horizon is clipped onto the limb rather than folded across the front.
- Solved: the roll. `θ = s / r`, so the panels come round *because* the ball travelled, and rolling it backwards unrolls them. That holds under the controlled prop and under your finger, not only in the loop.
- Illustrated: the air, as everywhere in this family. `bend` holds the Magnus term at its release value, so the kick is one quadratic; a real ball's spin decays and its drag curves the path, and neither is modelled.

## Usage

```tsx
import { RobotSoccerBall } from "@/components/ui/robot-soccer-ball"

// A standing spin axis puts the Magnus term sideways.
<RobotSoccerBall behavior="bend" view="plan" />

// Or roll it yourself — the panels turn exactly as far as it moved.
<RobotSoccerBall travel={0.72} onTravelChange={setTravel} interactive />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `travel` | `number` | — | How far across it has rolled, 0 to 1. Supplying it stops the loop, and the turn still follows the travel. |
| `onTravelChange` | `(travel: number) => void` | — | Fires while it is dragged or keyed, so interaction works in controlled mode too. |
| `behavior` | `"roll" | "bend" | "juggle" | "spin" | "static"` | `"roll"` | What it does with nobody driving it. |
| `interactive` | `boolean` | `false` | Hand it to a person: drag left and right to roll it, or focus it and use the arrow keys. |
| `showPath` | `boolean` | `true` | On `bend`, draw the kick and the same kick with the spin taken out. |
| `panels` | `boolean` | `true` | Draw the 32 panels, culled by their own normals and clipped onto the limb. |
| `showGround` | `boolean` | `true` | Draw the ground line and the contact shadow. |
| `label` | `string` | — | Optional technical caption under the drawing. |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One ball, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `speed` | `number` | `0.35` | 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. |
| `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-soccer-ball.tsx`
