Re:15 uncoupled simple pendulums of increasing lengths dance...
by gautier on Saturday August 27, 2011 @08:48AM
(#2931351)
You wish for it, HTML5 delivers. http://pepsdev.com/pendulums/
[ Parent
| on HN ]
Re:15 uncoupled simple pendulums of increasing lengths dance...
by city41 on Saturday August 27, 2011 @09:19AM
(#2931394)
A slight tweak to draw the pendulums too makes the simulation look much nicer:
function draw (Ls, t, h) {
// only for in the program, needed?
for (var i = 0; i < Ls.length; i++) {
...
ctx.lineTo(h * L, 0)
ctx.arc(h * L, 0, 6, 0, 360)
ctx.stroke()
ctx.fill()
...
}
}
to do it right you really need to start another path, but this works fine in Chrome (looks little wonky in Firefox)
Re:15 uncoupled simple pendulums of increasing lengths dance...
by gautier on Saturday August 27, 2011 @09:32AM
(#2931420)
thanks, that's much nicer indeed.