forever components

Cosmic & Space

Gravitational Lens Ring

Stars and galaxy arcs bend tangentially around a dark mass; alignment drifts to form a glowing magenta Einstein ring. Pointer shifts alignment offset.

canvasheavy complexitymoderate motionpointer

Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited

Live demo — the real component, running in a sandbox. One self-contained HTML file, zero dependencies. Open it on the canvas →
Worth keeping? Votes steer what gets built next — sign in to cast one, free to read

When to use it

Dark-mode hero backgrounds, science/space themes, ambient screensavers where a dramatic but calm cosmic effect is needed.

When not to

Light backgrounds (hardcoded dark purple), contexts needing legible text over the center, or low-end devices where canvas arc loops may stutter.

Working with an AI agent

Every component ships agent-ready metadata. An example instruction for this one:

Change the Einstein ring color from magenta to electric blue by replacing all 'rgba(255,158,210' values with 'rgba(0,180,255', and slow drift by changing t*0.011 to t*0.006.

Safe to edit

  • star count (150 in loop)
  • drift oscillation speed (t*0.011)
  • Einstein radius scale (R=Math.min(W,H)*0.28)
  • ring glow color (rgba(255,158,210))
  • pointer nudge strength (1.6 multiplier)
  • source galaxy point count (70 in loop)

Keep intact

  • DPR-aware canvas sizing and setTransform
  • visibilitychange stop/start guard
  • prefers-reduced-motion static draw branch
  • IIFE wrapper

Known limitations

  • Background color hardcoded in both CSS and fillRect — must change both to retheme
  • No meaningful reduced-motion fallback beyond one static frame
  • Pointer nudge decay is frame-rate dependent (nudge*=0.95 per frame)

spacegravitational-lenscanvasphysicsambientgenerativearcs

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.