Thursday, 13 September 2012

HTML5 Canvas - Animation

This script shows how to perform simple animations with Canvas in HTML5. The following techniques are adopted:

  1. Canvas for graphics.
  2. Draw circles.
  3. Use setInterval() to set up a timer trigger.

Output


When the file is viewed in a browser such as Chrome or Firefox, it appears as below. Note that the black ball is bouncing on the canvas frame.


Source Code


No comments:

Post a Comment