how to call methods of excanvas?

148 views Asked by At

I need a little help from you. I have created a canvas image using excanvas.js and it was rendered properly. Now i want to use that same canvas to draw another image but before that i need to clear that same canvas otherwise images will be overlapped over each other. Can anyone please explain how can i call fillRect() or any another method from excanvas.js for the same canvas element ?? I am using IE 8 as browser.

1

There are 1 answers

0
nullpotent On
ctx.clearRect(0, 0, excanvas.width, excanvas.height);

or perhaps:

ctx.fillStyle = "#ffffff"; 
ctx.fillRect(0, 0, excanvas.width, excanvas.height);

Where excanvas is your DOMElement canvas, and ctx being its 2d context (via getContext('2d')).