Back to portfolio
Physics · Live Demo
Cloth Simulation
A real-time cloth built from a grid of point masses linked by distance constraints. It uses Verlet integration — positions carry their own velocity — and relaxes the constraints several times per frame so the fabric holds together while still swinging and stretching under gravity.
- Verlet integration — Velocity is implicit in the previous position — stable and simple.
- Constraint relaxation — Each thread is solved a few times per frame to keep the weave taut.
- Drag & tear — Pull the cloth around, or switch to Cut mode to slice through the threads.
JavaScriptCanvasVerletPhysicsSimulation
View source on GitHubClick & drag the cloth to pull it around.