Springs with Canvas

Fluffy linesEven more Canvas vs Maths fun! This JavaScript demo vaguely emulates some spring physics. There are 10 linked points - each of whose acceleration is determined by the distance to the spring in front of them. A nice curve drawn between each point using the quadraticCurveTo command. And it sure makes some perdy patterns.

The controls let you adjust the friction and the spring strength, as well as turn on or off the "trails". Clicking on the canvas element will toggle drawing (so you can "lift your pen"). Anyhoo, that's it. Make some lines!