[Bonsai Image] Bouncing Balls

See my new Javascript implementation of the Bouncing app here. Updated for 2016!

Back to the main applet index page


Each ball is animated in a separate thread; access to the applet's canvas for updating the position of each ball is synchronized on the "box" object that contains the canvas and the collection of ball objects.

I know that it's better to use double buffering when doing an animation in order to eliminate flashing, but double buffering isn't used by this applet. The point of the exercise here is to see how far I could get without having some central loop in the box object that refreshes all the bouncers in "lock step". Instead, each bouncer redraws itself at its own rate; there's no central loop. Except for a small amount of residual flashing, this seems to come off pretty well.


Source code
[Back to the Applets Page] Back to my Applets page.