Skip to content
Advertisement

Tag: fabricjs

Fabric.js create dynamic image mask

I want to mask the original image using alpha mask image. I can do alpha masking on image with the following code. But I want to be able to edit the mask with the brush, how can I do that? In theory if I paint the mask white it should be opaque, if I paint it black it should be

Pass headers in fabric Image.fromURL function

I am using fabric.js Image.fromURL function to load the image to canvas. For now, the images are loading successfully without any issues. But now I have a requirement to pass headers for authentication purposes is there a way that I could pass headers into the “Image.fromURL” function or any other way I could incorporate my headers to it. Answer Image.fromUrl

FabricJS: Vertical Align text center

I am using fabricjs 1.5 and I am stuck on aligning the text in the middle of the line vertically. I am using this code to set the line height It changes the line height of text on canvas but text always remains at the top. I want it to be in the vertically middle. Please help. Answer You need

How to show the full SVG using Fabricjs?

First time user of FabricJs and I’m trying to load these SVG files using FabricJS as shown in their examples If you run the code snippet you will see that only the top part of the image is loaded instead of the entire SVG. I tried doing this with the other method where I create a new Image() and then

How to set canvas origin to center in fabricjs?

When I draw a circle on fabricjs canvas it always appears on bottom right corner even though I set the coordinates to center. How can I make the circle draw center of the canvas? Answer You can set drawing origin of the circle object to center, using originX and originY property.

Advertisement