Tiny Planet
A seeded flat skyline bends into a tiny planet through a polar remap, then keeps turning beside a red sun
$ pnpm dlx shadcn@latest add @remocn/tiny-planetUsage
TinyPlanet draws a seeded two-row skyline with lit windows and spires on a
flat horizon, then bends it into a circle like the tiny planet effect in
360° photography. The strip is exactly as long as the planet's circumference,
so it closes without a seam. While it bends the planet shrinks to fit the
frame and the sun drifts up and to the right. Once closed, the planet turns at
a steady rate for as long as the sequence lasts.
import { TinyPlanet } from "@/components/remocn/tiny-planet";
export const Hometown = () => (
<TinyPlanet buildings={32} seed={9} sunColor="#F5B83D" />
);buildings is the front row count (minimum 4); the back row gets 80% of
that. seed changes widths, heights, spires and windows. spin is the final
turning rate in degrees per frame at 30 fps, and spin={0} leaves the planet
still once it closes.
Timing
At 30 fps and speed={1}:
| Frames | Motion |
|---|---|
| 0–8 | The flat skyline holds |
| 8–40 | The skyline bends into a planet on an ease-in-out, fastest around frame 24 |
| 26–40 | The spin eases in while the strip closes |
| 40+ | The planet turns at spin degrees per frame for as long as the sequence lasts |
length covers the bend. Give the sequence a few extra seconds if you want
the turning planet to hold behind a title. speed scales the whole timeline,
including the spin rate.
| Prop | Type | Default | Description |
|---|---|---|---|
buildings | number | 26 | Buildings in the front row, minimum 4; the back row gets 80% as many |
seed | number | 4 | Seeds building widths, heights, spires and windows |
spin | number | 0.7 | Planet spin once bent, in degrees per frame at 30 fps |
colors | Partial<TinyPlanetColors> | { sky: "#111111", ground: "#262626", near: "#FFFFFF", far: "#6B6B6B", window: "#111111", sun: "#E5322D" } | Sky background, ground, front and back building rows, windows and sun; merged over the defaults. The flat color props below win over it |
skyColor | string | "#111111" | Sky background; overrides colors.sky |
sunColor | string | "#E5322D" | Sun color; overrides colors.sun |
buildingColor | string | "#FFFFFF" | Front building row; overrides colors.near |
groundColor | string | "#262626" | Ground color; overrides colors.ground |
speed | number | 1 | Playback multiplier |