drawing on several canvases will be extremely inefficient, since rendering is one of the most expensive operations you can do.
what you want to do is use a buffer. you can just paint from one canvas to another.
var canvas1 = document.getElementById("canvas1"); var canvas2 = document.getElementById("canvas2"); var ctx1 = canvas1.getContext("2d"); var ctx2 = canvas2.getContext("2d"); ctx1.fillStyle = "black"; ctx1.fillRect(10, 10, 10, 10); ctx2.drawImage(canvas1, 0, 0);
here is fiddle .
remember, you only need to call ctx.drawImage once - after you finish with all the drawings on the first canvas.
source share