To clear the HTML5 Canvas, we can use the clearRect() method to clear the canvas bitmap. This performs much better than other techniques for clearing the canvas, such as resetting the canvas width and height, or destroying the canvas element and then recreating it.
Instructions: Click on the clear button to clear the canvas
Code Editor
Modified on April 9th, 2013
by Eric Rowell