Reputation: 47
I am new to canvas. I am wondering if I can take a Fabric JS canvas and put it on time of an existing Fabric JS canvas? If so, I would I do this.
Upvotes: 1
Views: 604
Reputation: 727
Yes, you can do this. Canvas backgrounds are transparent by default, so you are able to overlap them as layers. Use CSS to put the canvas
elements exactly on top of each other.
Make sure, when clearing the top canvas, you use clearRect
and not fillRect
with a background color (even white), as that would remove the transparency and hide the other canvas.
Upvotes: 1