No, however, you could layer multiple <canvas>
elements on top of each other and accomplish something similar.
<div style="position: relative;">
<canvas id="layer1" width="100" height="100"
style="position: absolute; left: 0; top: 0; z-index: 0;"></canvas>
<canvas id="layer2" width="100" height="100"
style="position: absolute; left: 0; top: 0; z-index: 1;"></canvas>
</div>
Draw your first layer on the layer1
canvas, and the second layer on the layer2
canvas. Then when you clearRect
on the top layer, whatever's on the lower canvas will show through.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…