Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You wish for it, HTML5 delivers. http://pepsdev.com/pendulums/


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)


thanks, that's much nicer indeed.


awesome! at 60 seconds my theory is confirmed! thanks


Don't miss the moiré patterns in the wires.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: