Earth
Earth is a space animation in the UI HUB space & planets collection. A single raw-WebGL1 fragment shader raytraces the Earth over one full-stage quad. Five image assets load through an Image + Canvas2D pass into module-level caches: the day map, night lights (sampled at 4096x2048), water mask, topology height map and cloud sheet.
The component is driven by 15 documented props (map, background, stars, size, look, look.clouds and 9 more), so colours, intensity, timing and density can be tuned from the call site instead of being hard-coded.
Implementation notes: WebGL1 fragment shader (sphere raytrace); Remote equirectangular textures with crossOrigin anonymous; Image + Canvas2D pixel extraction.
Preview the space animation in the browser above, copy the source, and paste it into your project. Space & Planets components in UI HUB are grouped by category so you can compare effects side by side before choosing one.
What is Earth?
A photoreal, endlessly rotating Earth on a raw WebGL1 canvas: a real blue-marble day map, city lights on the night side, a drifting cloud deck that casts shadows, water specular, bump-mapped relief and a blue atmospheric limb, over a parallax starfield. Drag to spin the globe, move to lean it toward the cursor and steer the sun.
Earth at a glance
- Category
- Space & Planets
- Pricing
- Free to use
- Libraries
- React
- Language
- TypeScript
- Styling
- Tailwind CSS
- Configurable props
- 15
- AI prompts
- Ready for Advance, Antigravity, Claude Code, Cursor, Lovable
How Earth works
A single raw-WebGL1 fragment shader raytraces the Earth over one full-stage quad. Five image assets load through an Image + Canvas2D pass into module-level caches: the day map, night lights (sampled at 4096x2048), water mask, topology height map and cloud sheet. Colour maps upload as HTMLCanvasElement textures, while the three single-channel masks are extracted into Uint8Array byte planes and packed once into one RGBA aux texture (water in R, topology in G, clouds in B), so the shader needs only three samplers. Per fragment the shader unprojects the pixel to a unit-sphere normal, rotates it by a 3x3 matrix composed of yaw, pitch, the -23.44 degree axial tilt and a damped hover view matrix, then maps it to equirectangular UVs. Shading combines a pow-2.2 albedo with warm-to-neutral sun colour and wrapped diffuse, a cloud layer sampled with a sun-offset lookup so clouds cast shadows on the deck below, bump-mapped normals from neighbouring topology taps, two specular water lobes driven by the water mask, a night-side city-light ramp gated by cloud cover, a fresnel atmospheric rim and halo, ACES-style tonemapping, and a hash-grid parallax starfield. Every frame eases in the light vector, the cloud drift, the spin (drag momentum with a spring return on pitch) and a four-channel fade-in as each texture becomes ready.
Technical information for Earth
| Category | Space & Planets |
|---|---|
| Libraries | React |
| Styling | Tailwind CSS |
| Language | TypeScript |
| Rendering | WebGL shaders, HTML canvas |
| State change | deep-space blue marble lit by a cursor-driven sun while the cloud deck drifts and city lights bloom on the night side to user-spun globe turning on both axes with inertia, the terminator swinging across continents and the starfield parallaxing with the pointer |
| Props | 15 configurable |
| Usage example | Not published yet |
What Earth requires
- WebGL1 fragment shader (sphere raytrace)
- Remote equirectangular textures with crossOrigin anonymous
- Image + Canvas2D pixel extraction
- ResizeObserver
- requestAnimationFrame loop
- Pointer events with inertia
- prefers-reduced-motion support
- devicePixelRatio cap with a 5MP pixel budget
- WebGL loss-context teardown
Earth questions
What is Earth?
A photoreal, endlessly rotating Earth on a raw WebGL1 canvas: a real blue-marble day map, city lights on the night side, a drifting cloud deck that casts shadows, water specular, bump-mapped relief and a blue atmospheric limb, over a parallax starfield. Drag to spin the globe, move to lean it toward the cursor and steer the sun.
How does Earth work?
A single raw-WebGL1 fragment shader raytraces the Earth over one full-stage quad. Five image assets load through an Image + Canvas2D pass into module-level caches: the day map, night lights (sampled at 4096x2048), water mask, topology height map and cloud sheet. Colour maps upload as HTMLCanvasElement textures, while the three single-channel masks are extracted into Uint8Array byte planes and packed once into one RGBA aux texture (water in R, topology in G, clouds in B), so the shader needs only three samplers. Per fragment the shader unprojects the pixel to a unit-sphere normal, rotates it by a 3x3 matrix composed of yaw, pitch, the -23.44 degree axial tilt and a damped hover view matrix, then maps it to equirectangular UVs. Shading combines a pow-2.2 albedo with warm-to-neutral sun colour and wrapped diffuse, a cloud layer sampled with a sun-offset lookup so clouds cast shadows on the deck below, bump-mapped normals from neighbouring topology taps, two specular water lobes driven by the water mask, a night-side city-light ramp gated by cloud cover, a fresnel atmospheric rim and halo, ACES-style tonemapping, and a hash-grid parallax starfield. Every frame eases in the light vector, the cloud drift, the spin (drag momentum with a spring return on pitch) and a four-channel fade-in as each texture becomes ready.
Which category does Earth belong to?
Earth is listed under Space & Planets in the UI HUB catalog. Celestial components that render real planets, moons and orbital scenes in the browser: procedurally textured spheres, rotating bodies and interactive space backdrops. Each one is built as a self-contained React component with documented props, so you can drop a rotating moon or planet straight into a hero, a section or a full-page intro. Preview it live, then copy the exact source.
What does the map prop do in Earth?
Custom equirectangular day-map URL (or { src }); falls back to the bundled blue-marble texture when it fails to load. It defaults to undefined.
What does the background prop do in Earth?
CSS background painted behind the globe and the starfield. It defaults to "#02040A".
Is Earth free to use?
Earth is a free component on UI HUB. You can preview it in the browser and read the full props table on the component page.
Which libraries does Earth use?
Earth uses React and is styled with Tailwind CSS.
What does Earth need to run?
Earth needs WebGL1 fragment shader (sphere raytrace), Remote equirectangular textures with crossOrigin anonymous, Image + Canvas2D pixel extraction and ResizeObserver.