user5749747
user5749747

Reputation: 47

FabricJS canvas on top of another FabricJS canvas

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

Answers (1)

Matt Mokary
Matt Mokary

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

Related Questions