forever components

Particles & Physics

Liquid Pour SPH

200 SPH fluid particles pour into a basin, slosh, and drain on a slow cycle with additive-blend cyan glow; pointer move tilts the fluid sideways.

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

Ambient hero backgrounds for tech/creative sites, loading screens, interactive art installations requiring realistic-feeling fluid.

When not to

Low-end mobile or battery-sensitive contexts — double-density SPH relaxation loop runs 2 substeps per frame. Avoid where text legibility over the background matters.

Working with an AI agent

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

Change the fluid color to molten orange by replacing the glow stops to 'rgba(255,140,30,0.26)' and 'rgba(255,100,10,0.182)', and set REST=3.0 to make the fluid less compressed. 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

  • particle count (N=200)
  • SPH stiffness (STIFF=0.55) and rest density (REST=2.6)
  • glow color stops in buildGlow()
  • basin proportions (bx0=W*0.30, bx1=W*0.70, floorY=H*0.82)
  • pour oscillation amplitude (*(bx1-bx0)*0.22)
  • gravity strength (GRAV=0.30)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • precomputed glow sprite pattern (buildGlow) — avoids per-particle gradient cost
  • double-substep loop (2 × dt*0.5) for stability
  • visibilitychange pause/resume
  • reduced-motion static pool fallback
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • Spatial hash uses string keys — allocation pressure at high N; switch to integer keys for >300 particles
  • Particle recycling uses Array.indexOf + splice inside tight loop — O(n) per removed particle
  • No reduced-motion animation — shows a static settled pool only

sphfluidparticlesphysicscanvasmetaballgenerative

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.