Rahul Gurung

Rahul Gurung

490 Articles Published

Articles by Rahul Gurung

Page 26 of 49

FabricJS – Capturing the Stream of a Polygon Converted to a HTMLCanvasElement?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 388 Views

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to convert a polygon object into HTMLCanvasElement we use the toCanvasElement method. It returns the DOM element of type HTMLCanvasElement, an interface which inherits its properties and methods from the HTMLElement interface. We use the captureStream method to capture stream of Polygon converted ...

Read More

FabricJS to setting the Background Colour on Selection of Circle

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 372 Views

In this tutorial, we are going to learn how to set the background colour of selection of a Circle using FabricJS. Circle is one of the various shapes provided by FabricJS. In order to create a circle, we have to create an instance of fabric.Circle class and add it to the canvas. We can change an object's dimensions, rotate it or manipulate it when the circle is actively selected. We can change the background colour of selection of Circle by using the selectionBackgroundColor property. Syntax new fabric.Circle({ selectionBackgroundColor: String }: Object) ...

Read More

How to lock the vertical skewing of a Triangle using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 215 Views

In this tutorial, we are going to learn how to lock the vertical skewing of a Triangle using FabricJS. Just as we can specify the position, colour, opacity and dimension of a triangle object in the canvas, we can also specify whether we want to stop skewing an object vertically. This can be done by using the lockSkewingY property. Syntax new fabric.Triangle({ lockSkewingY : Boolean }: Object) Parameters Options (optional) − This parameter is an Object which provides additional customizations ...

Read More

How to set the horizontal origin of transformation of IText using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 235 Views

In this tutorial, we are going to learn how to set the horizontal origin of transformation of IText using FabricJS. The IText class was introduced in FabricJS version 1.4, extends fabric.Text and is used to create IText instances. An IText instance gives us the freedom to select, cut, paste or add new text without additional configurations. There are also various supported key combinations and mouse/touch combinations which make text interactive which are not provided in Text. Textbox, however, which is based on IText allows us to resize the text rectangle and wraps lines automatically. This is not true for ...

Read More

FabricJS – Check if a Polygon Object is Fully Contained within Another Object?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 621 Views

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. We use the isContainedWithinObject method to find whether a polygon object is fully contained within the area of another object. This method returns a boolean value indicating if the polygon is completely inside the boundaries of another fabric object. Syntax isContainedWithinObject(other: Object, ...

Read More

How to create a canvas with a background color using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 1K+ Views

In this article, we are going to create a canvas with a given background color using FabricJS. The default background color provided by the FabricJS API is white and it can be customized using the backgroundColor option. Syntax new fabric.Canvas(element: HTMLElement|String, { backgroundColor: String }: Object) Parameters element − This parameter is the element itself which can be derived using document.getElementById() or the id of the element itself. The FabricJS canvas will be initialized on this element. ...

Read More

How to set the border opacity of a Circle while moving using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 339 Views

In this tutorial, we are going to set the border opacity of Circle while moving using FabricJS. Circle is one of the various shapes provided by FabricJS. In order to create a circle, we will have to create an instance of fabric.Circle class and add it to the canvas. We can change the opacity of circle while moving it around in the canvas by using the borderOpacityWhenMoving property. Syntax new fabric.Circle({ borderOpacityWhenMoving: Number }: Object) Parameters options (optional) − This parameter is an ...

Read More

How to maintain stroke width of a Triangle while scaling using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 203 Views

In this tutorial, we are going to learn how we can maintain the stroke width of Triangle while scaling using FabricJS. By default, the stroke width increases or decreases with respect to the object's scale values. However, we can disable this behaviour by using the strokeUniform property. Syntax new fabric.Triangle({ strokeUniform: Boolean }: Object) Parameters Options (optional) − This parameter is an Object which provides additional customizations to our triangle. Using this parameter, properties such as colour, cursor, stroke width, and a lot ...

Read More

How to set the offset amount for text path in IText using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 416 Views

In this tutorial, we are going to learn about how to set the offset amount for text in IText using FabricJS. The IText class was introduced in FabricJS version 1.4, extends fabric.Text and is used to create IText instances. An IText instance gives us the freedom to select, cut, paste or add new text without additional configurations. There are also various supported key combinations and mouse/touch combinations which make text interactive which are not provided in Text. Textbox, however, which is based on IText allows us to resize the text rectangle and wraps lines automatically. This is not true ...

Read More

FabricJS – How to set the background colour of selection of an Image?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 913 Views

In this tutorial, we are going to learn how to set the background colour of selection of Image using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to set the background colour of Image, we use the selectionBackgroundColor property. Syntax new fabric.Image( element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, { selectionBackgroundColor: String }: Object, callback: function) Parameters ...

Read More
Showing 251–260 of 490 articles
« Prev 1 24 25 26 27 28 49 Next »
Advertisements