Relative Content

Tag Archive for javascriptfabricjs

Fabric.js how to subclass the `fabric.Object`

I’m working on a project where fabric.js (version 5.3) is used in several different places. I have recently built a requested feature with it and in the meantime, I had to extend some fabric classes like fabric.Object, fabric.Shadow, fabric.Line etc. and their prototype methods to apply custom logic.

fabric.js-When to use “setCoords” method?

In fabric.js, when should the ‘setCoords’ method be used? Is it necessary to use ‘setCoords’ method after the ‘set’ method? For example, if I use the ‘set’ method to change the width of a rectangle, should I also use ‘setCoords’?

Mask or clip given polygon in FabricJS

I have a background and an unlimited amount of images or animations where I’d like to mask or clip part of the image or animation to the background. I’d like the user to use or move around a polygon to determine where they would like this to happen. See JSFiddle