Skip to content
MotionLab

Fluid Simulation (Worker)

Stable-fluids solver running in a Web Worker, rendering to an OffscreenCanvas.

★ showcaseWeb WorkerCanvas 2D

How it works

Jos Stam “Stable Fluids”: advect → diffuse → project (Gauss-Seidel) on a 128² grid. Canvas control is transferred to the worker with transferControlToOffscreen().

Performance

The main thread only posts pointer events — scroll and UI stay at 60fps even if the solver drops frames. Falls back to main thread if OffscreenCanvas is unsupported.

Accessibility & reduced motion

Decorative; reduced mode renders a single still frame.

Playgroundcustom
Export
{
  "viscosity": 0.00002,
  "dissipation": 0.985,
  "force": 12,
  "radius": 3
}