Wave Simulation
An interactive wave simulation animates a one-dimensional fluid surface using the Canvas 2D API. The animation runs via `requestAnimationFrame`, rendering a filled water silhouette defined by a grid of 150 cells whose heights evolve through neighbor-based velocity updates, dampening, and mass conservation correction. Clicking or dragging the mouse pulls the water surface directly toward the cursor. The underlying physics model uses simple spring-like forces between adjacent cells, with pull strength and dampening factors controlling the motion.
AI-generated descriptionInteractive simulation of one dimensional fluid waves.
Try clicking & dragging!
The original wave simulation was done in 2012, part of HTML5Examples (source).
I just went through and upgraded the code to be more modern. Fun!