I am using multiple canvas in an html page as layers as in html5 - canvas element - Multiple layers but I am experiencing some problems. If I draw them
<canvas id="overlay"></canvas>
<canvas id="widget"></canvas>
I see all the drawings and there are no problems but if swap them
<canvas id="widget"></canvas>
<canvas id="overlay"></canvas>
Then I only see the "widget" canvas. at the moment the drawing code is fairly simple.
// overlay
ctx.clearRect(0, 0, overlay.width, overlay.height);
ctx.beginPath();
ctx.moveTo(0, 25);
ctx.lineTo(0, 200);
ctx.stroke();
// widget
ctx.clearRect(0, 0, widget.width, widget.height);
has anyone encountered this problem? Am I doing something wrong?