Particles & Physics
Spring Chain
A 16-node spring chain whips and follows the cursor in a lime-to-gold gradient; drifts in a figure-eight pattern when idle.
canvasmedium complexitymoderate 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
Cursor-follower effects, interactive hero backgrounds, playful physics demos where pointer engagement adds delight.
When not to
Contexts requiring legible overlaid text (constant motion competes). Touch-only devices where pointer events are limited to taps.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change node count from 16 to 24, set the hue base to 120 (green), and increase spring stiffness constant k from 0.32 to 0.45. 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
- node count (N=16)
- spring stiffness (k=0.32)
- damping factor (damp=0.74)
- hue start and step (90-i*3.5)
- segment length (seg = min(W,H)*0.055)
- idle figure-eight amplitude (W*0.3 / H*0.3)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- DPR-aware canvas sizing
- visibilitychange pause/play guards
- reduced-motion guard (single frame only)
- IIFE-equivalent scoped vars
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- Reduced-motion support is minimal — draws one static frame but the chain is still mid-motion; no true static fallback
- Segment length computed at init with W/H at that moment — does not recompute on resize (reinits nodes but seg is const)
- No IIFE wrapper — globals leak into page scope
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.
- 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.
- Metaball Fluid7 hot-pink blobs drift and merge via a high-contrast canvas threshold; cursor adds an attracting blob that pulls them toward the pointer.