forever components

Particles & Physics

Double Pendulum Ghost

A double pendulum swings chaotically in emerald, tracing a slowly fading color-shifting ribbon ghost on canvas; pointer nudges velocity, click rekicks.

canvasheavy complexityintense 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, screensavers, science/math-themed portfolios, ambient generative art displays.

When not to

Light backgrounds (hardcoded dark #16201A). Contexts requiring calm or subtle motion — the chaotic path is visually intense and unpredictable.

Working with an AI agent

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

Change the accent hue from emerald to teal by setting the strokeStyle hue base from 140 to 180 and the rod/bob color from #378651 to #80ffee, then slow substeps from 8 to 4 for a lazier swing. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.

Safe to edit

  • accent hue base (140 in strokeStyle hsla)
  • substep count per frame (s<8)
  • trail fade speed (0.012 in fillStyle alpha)
  • bob size scale (L*0.04 / L*0.034)
  • damping coefficient (0.99992)
  • initial angle range (rekick values)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • RK4 integrator (step function)
  • offscreen trail canvas (tr/tctx) for ghost ribbon
  • visibilitychange pause/resume
  • reduced-motion static fallback
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • Background color hardcoded in CSS and canvas fill — must edit both to change
  • No reduced-motion animation fallback beyond a single static frame
  • RK4 with 8 substeps per frame is CPU-intensive on low-end devices

double-pendulumphysicschaostrailcanvasglowgenerative

More Particles & Physics components

  • Gravity Dot RainMulticolored dots fall under gravity with motion trails, bounce off the floor, and scatter away from the cursor on a dark navy canvas.
  • Firework BurstColorful glowing sparks burst radially, fall under gravity, and fade against a dark sky. Auto-launches bursts; click anywhere to add more.
  • Confetti CannonColored rectangles fire from bottom corners in auto-cycling bursts, tumbling with gravity and flip animation. Click anywhere to trigger a cursor burst.
  • Bouncing Balls7–14 glossy pastel balls bounce off walls and collide with elastic physics; cursor repels balls within a 70px radius.
  • Spring ChainA 16-node spring chain whips and follows the cursor in a lime-to-gold gradient; drifts in a figure-eight pattern when idle.
  • Cloth Wave GridAn 11x11 wireframe grid ripples like cloth via sine/cosine waves in cyan-to-violet hues; mesh nodes bulge away from the cursor on hover.