Cosmic & Space
Drifting Nebula
26 soft radial blobs in pink, violet, and blue drift with additive blending over 70 twinkling stars; cursor gently pulls the nebula clouds.
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 or sci-fi themes, ambient looping screensavers where gentle motion sets atmosphere.
When not to
Light-background UIs (background hardcoded dark purple). Content-heavy layouts where text legibility matters.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the color palette to cool teal/green tones by replacing cols with ['90,255,200','60,200,180','100,255,150','40,180,220'], and increase blob count N from 26 to 36 for a denser nebula.
Safe to edit
- blob count (N=26)
- color palette (cols array)
- drift speed (dx/dy *= 0.0004)
- breathe intensity (0.85+0.15*sin)
- pointer pull strength (0.02)
Keep intact
- IIFE wrapper
- visibilitychange pause/start
- prefers-reduced-motion guard (t freezes, blobs stop moving)
- DPR-aware canvas sizing
Known limitations
- Background color hardcoded in CSS and canvas fill — must change both to alter base color
- Reduced-motion mode renders one static frame only; stars still twinkle since t still advances in that single frame
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.