Cosmic & Space
Parallax Depth Drift
Four-layer parallax starfield drifts laterally; near stars streak with motion-blur while the deep field barely moves. Pointer nudges the drift direction.
canvasmedium complexitysubtle motionpointer
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
Worth keeping?
Votes steer what gets built next — sign in to cast one, free to read
When to use it
Dark-mode hero backgrounds, space/sci-fi themes, ambient looping screensavers needing genuine depth.
When not to
Light backgrounds (hardcoded dark navy). Content-heavy layouts where continuous lateral drift competes with reading.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the foreground streaker count from 16 to 24 by editing LAYERS[3].n, and shift the color to electric blue by setting LAYERS[3].col to '100,180,255'.
Safe to edit
- star counts per layer (LAYERS[i].n)
- drift speed per layer (LAYERS[i].sp)
- star size per layer (LAYERS[i].sz)
- layer colors (LAYERS[i].col)
- observer drift speed (obs += 0.18)
- pointer nudge strength (nudge*1.4)
Keep intact
- DPR-aware canvas sizing
- visibilitychange pause/resume
- prefers-reduced-motion guard (static draw fallback)
- IIFE wrapper
Known limitations
- Background color hardcoded in CSS and canvas fill — must change both to retheme
- Streak direction is always left-to-right regardless of drift direction
- No touch-based nudge — pointer nudge only fires on pointermove, not device orientation
More Cosmic & Space components
- Orbiting Planet SystemFour glowing planets orbit a radiant sun on tilted elliptical rings with depth-sorted rendering; the system drifts subtly toward the pointer.
- Black-hole Accretion Swirl110 heat-colored particles spiral inward across a tilted accretion disk toward a glowing event horizon; pointer movement boosts swirl speed.
- Twinkling Starfield115 multicolor stars twinkle via sine waves; sparkle crosses appear on larger stars; stars brighten near cursor. Static fallback for reduced-motion.
- Spiral Galaxy Rotate115 stars form a two-armed spiral galaxy rotating around a violet radial-gradient core; pointer move briefly doubles spin speed.
- Comet Streak LoopCyan and violet comets with glowing heads and gradient tails streak diagonally across a twinkling dark starfield; click spawns an extra comet (up to 5).
- Ringed Planet RotateAmber gas giant with tilted Saturn-like rings slowly rotates over a twinkling starfield; pointermove adjusts ring tilt and light angle dynamically.