# Planet

A tilted, turning globe with latitude bands, polar caps, longitude storms and a ring system the body genuinely occludes — the far arc is cut where the silhouette crosses it.

> 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/celestial-planet.json
```

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

## Notes

- The rings are the mechanism. They are one annulus in the body's own equatorial plane, and a ring point is hidden when it is behind the centre plane and its perpendicular distance to the line of sight is inside the radius — exact for a sphere seen orthographically. The visible runs are drawn far, globe, near.
- The day-night line is not drawn: `terminator` returns the great circle where the light grazes the sphere, and the night side is the camera-facing half of that circle closed against the unlit half of the limb.
- A latitude band is a ring about the pole, so rotation cannot move it. The storms have a longitude, which is what makes the spin something you can see.
- Solved: the terminator and its projection, the ring occlusion split, the bands and caps on the turning body, the moons' orbits, and the silhouette — which is the projected limb circle, not an assumed circle. Illustrated: the storm ovals and the band weights.
- No gravity and no scale. The moons do not perturb anything, and nothing here is a real world.

## Usage

```tsx
import { CelestialPlanet } from "@/components/ui/celestial-planet"

<CelestialPlanet surface="banded" tilt={26} rings moons={2} />
<CelestialPlanet spin={140} sun={110} interactive onSpinChange={setSpin} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"front"` | Where the camera stands. One body, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `spin` | `number` | — | Controlled rotation about the pole, in degrees. Supplying it stops the loop. |
| `behavior` | `"rotate" | "orbit" | "tumble" | "static"` | `"rotate"` | Rotate turns it; orbit walks the light round with it so the phase changes; tumble carries the pole round at a different rate. |
| `speed` | `number` | `0.1` | Revolutions 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` | Drag across the globe to turn it; arrows 10 degrees, shift 30, Home and End park it. |
| `onSpinChange` | `(spin: number) => void` | — | Fires on every drag and key press, in controlled mode too. |
| `tilt` | `number` | `24` | Degrees the pole leans out of vertical, clamped to ±90. |
| `precession` | `number` | `18` | The bearing the pole leans toward, in degrees. |
| `sun` | `number` | — | Where the light is, in degrees round the body; 0 is behind the viewer. Omit and the behaviour decides. |
| `sunHeight` | `number` | `8` | Degrees the light stands above the body's orbital plane. |
| `surface` | `"terrestrial" | "banded" | "ice" | "molten"` | `"banded"` | Which kind of world: it changes the banding, the cap latitude and the storm count, never the palette. |
| `rings` | `boolean` | `true` | A ring system in the equatorial plane, occluded by the body. |
| `moons` | `number` | `1` | Bodies on real Kepler orbits around it, clamped to 0..3. They go behind the globe too. |
| `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. |
| `signal` | `"idle" | "ready" | "warning"` | — | Status-lamp state using neutral, accent, or shell colour; each component documents its visual default in the demo. |
| `label` | `string` | — | Optional technical caption under the drawing. |
| `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/celestial-planet.tsx`
