Globe Pro
One payment, every Pro piece. $10 tomorrow.
Install
npx shadcn@latest add @mu-pro/globePro. Installs with your licence key through the @mu-pro registry; the key comes with Pro. Lands in components/mu/globe/ with the shared foundation.
Usage
import { Globe } from "@/components/mu/globe/Globe";
const places = [
{ lat: 51.5, lon: -0.12, label: "London", detail: "1,118 teams" },
{ lat: 12.97, lon: 77.59, label: "Bengaluru", detail: "1,204 teams" },
{ lat: 35.68, lon: 139.69, label: "Tokyo" },
];
<Globe places={places} routes={[[0, 1], [1, 2]]} label="Where our teams are" />Source
How it works
Building with an agent? Hand it a ready prompt for this piece.
Input and reduced motion
- Names: each facing lamp's name sits beside it, printed on the metal (a quiet ink with a ring in the metal's own tone, so it reads on the sea, the land and the line of light alike). It rides the turn and fades toward the edge, so a name round the back never shows; it stays on the globe and clear of the other lamps and the lit route, right of its lamp or left where the right is taken or would run off. Where two would overlap, the one nearer the centre wins and the other leaves in
--mu-fast, coming back a beat after there is room. The print takes the metal's light where it lies: where the room lights the metal its ink and ring turn lighter, in shade darker, over--mu-morph. The route's end keeps its emphasised name with its detail. - In view: it turns at one calm speed (a turn a minute), and one route at a time lights: the wire fades in with its two lamps, a bead of light runs it in 2s, the place's name arrives as it lands and holds, then the next route that faces you takes over. Off screen it stops (no frames at all) and keeps its place.
- Pointer / touch: drag it any way and it turns freely, like a ball in your hand: sideways, up and down, or round over a pole, with the surface following your finger from where it is (a drag turns it about the axis across your drag, so the two directions compose into one real rotation, with no flip or snap at the poles). Let go and it keeps your throw's speed and direction, which run down over 1.2s back to the calm turn; the calm turn is always about the globe's own pole, so a globe you tipped keeps turning on its axis where you left it, and once it has rested 2s after a drag its pole eases back upright at the same calm speed (never under reduced motion). On touch a finger on the sphere is the globe's: it turns it any way, and a pinch still zooms the page. The page scrolls from a swipe that starts off the sphere: in the ring of the box round it (a tenth of the box each side) or beside it. A globe as wide as a phone's column leaves only that ring, so where the page must scroll past it easily, give it a smaller
sizeon a phone. A route whose two ends you turn round the back fades early. The globe gives a little while you hold it. Labels, routes, lamps and the flare follow any orientation; every name is set from its lamp's own whole-pixel centre, so it never swims from its lamp while you swirl it. - Keyboard: Tab to the globe (a slider named "Turn the globe" whose value is the longitude in front of you, read out as "Facing 51° N, 0° W, near London"). The keys read as on a map: right and left turn it 15° to bring the east or the west to the front, up and down 15° to bring the north or the south, Page Up and Page Down a quarter turn east or west, and Home and End turn to your westernmost and easternmost place, centred (with no places, 90° W and 90° E). Each eases over
--mu-morph(at once under reduced motion); a second press adds to what is left. A turn from the keys stays where you put it (the pole doesn't right itself after it), Enter chooses the place it faces, and Escape during a drag puts it back where it was. The places are also in a list for screen readers. - Reduced motion: a still, lit globe with its first route drawn and named; no turn, no bead, no flare. A drag still turns it, in any direction, and stops where you let go, and a key turns it at once.
- No WebGL2, or a GPU drawn in software: the same globe holds still until a hand turns it (without WebGL2 it is shaded on the CPU, once per turn a hand gives it). A lost GPU context is restored and repainted.
Cost
About 14 KB gzip of its own JS, 3.4 KB of which is the land (Natural Earth 110m, simplified and packed as text, in land.ts). The metal is one fragment shader; the lamps, wire and flare are sprites drawn once per theme and stamped. On a 3× phone with a 4× slower CPU and a graphics card, it holds 60fps while it turns and while a hand throws it (frame p95 16.7ms); the calm turn draws a frame only once the surface has moved √dpr device px (every other frame on a phone) and sleeps between, so with its routes it costs about 15 ms of main thread a second where waking every frame cost 18 (an A/B on one machine; 61 under the builder's heavier load), and with a route held, 10 where it cost 16, a drag with its coast about 60, at the budget (50–67 over 16 runs on one machine with a graphics card, the same as before the frame's turn and route maths were made allocation-light; the earlier 135 was under a heavier load), of which 15–21 is its own script and the rest the browser's input, paint and canvas commit, and off screen nothing. Without a graphics card it is still at rest (under 1 ms a second) and costs 340–465 ms a second only while a hand turns it.
Props
| Prop | Default | What it does |
|---|---|---|
places | [] | any number | the lamps: { lat, lon, label, detail?, id? } in degrees north and east; id is yours (a record's key), never shown, and handed back untouched by onPlaceSelect. label is read out, printed beside its lamp while it faces you, and shown over the lamp at a route's end with detail beside it |
routes | each place to the next | pairs of indices into places | lit one at a time, in order; a route round the back of the globe waits its turn |
size | 320 | 48–640 px | the globe's diameter. Its box is 1.25× that (room for the lifted wire, the flare and the day shadow) and shrinks with a narrower column. Detail follows size: lathe grooves from 80px, up to 12 facing places' names from 240px (only the nearest under it, none under 120px), the route's end named from 180px, only the lit lamps under 80px |
label | "Globe" | text | what a screen reader calls the whole globe (its <figure>) |
labels | { turn: "Turn the globe", facing: "Facing", near: "near" } | text | the control's name, and the words of its value: the point in front of you and the place nearest it ("Facing 51° N, 0° W, near London") |
accent | false | — | tints the lamps' light, their glow and the bead with --mu-signal; the metal stays neutral |
sound | off | true or 0–1 | the bearing's purr when a throw lets it go (see Sound) |
onPlaceSelect | — | (place, index) => void | called when a place is chosen: a click or tap on its lamp or its printed name (a drag is a turn, never a choice), or Enter on the globe for the place it faces, the one a screen reader hears ("… near London") |
className | — | — | added to the root |
Sound
Off unless you pass sound (true, or a volume 0–1). When a drag lets the globe go with a throw, the bearing's soft purr runs down with the 1.2s coast, louder for a harder throw. Never on a slow release, a key, a hover, on mount or from a prop change. setMuted(true) from components/mu/sounds.ts silences every cottoncandy item at once.
Licence
Included with Pro: use it in unlimited end products for you and your clients; no reselling as a kit. See the licence.
A globe milled from one block of metal. The sea is the lathe’s grooves and the land is raised in satin, with your places set in as lamps. It turns slowly under one fixed light and lights one route at a time; drag it and it coasts to a stop on its bearing.
For global reach, offices and routesMore in Data & live