Animation - Bouncing ball

No tutorial about animation would be complete without a bouncing ball example. For animation to work you need to make use of the built in Javascript timer. The code for this animation is shown below.

As the note at the top of the page indicates, using global variables (i.e. variables specified outside a function) in this way is generally not a good idea; because of possible side effects. A future update of this page should fix this.

Program output

Your browser doesn't support canvas technology