Rahul Gurung

Rahul Gurung

490 Articles Published

Articles by Rahul Gurung

Page 28 of 49

How to set the opacity of Image using FabricJS?

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

In this tutorial, we are going to learn how to set the opacity 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 opacity of Image, we use the opacity property. Syntax new fabric.Image( element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, { opacity: Number }: Object, callback: function) Parameters element − This parameter accepts HTMLImageElement, ...

Read More

FabricJS – Finding the current cursor position on the clicked Polygon object?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 928 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 find the current cursor position on the clicked Polygon object, we use the getLocalPointer method. Syntax getLocalPointer(e, pointer): Object Parameters e − This parameter accepts an Event which denotes the event to ...

Read More

How to create a canvas with background image using FabricJS?

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

In this article, we are going to create a canvas with a background image using FabricJS. There are two ways available in FabricJS, using which we can change the background image of the canvas. First method is by using the Canvas class itself and passing backgroundImage in the second parameter of the class. Second method is to use the setBackgroundImage method. Let's see into each of them with an example. ...

Read More

How to set the fill color of a Circle using FabricJS?

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

In this tutorial, we are going to learn how we can change the appearance of a Circle object by changing its fill colour 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 fill colour by using the fill property which allows us to specify the colour of the object's fill. Syntax new fabric.Circle({ fill: String }: Object) Parameters ...

Read More

How to set the style of individual characters in IText using FabricJS?

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

In this tutorial, we are going to learn how to set the style of individual characters 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 for ...

Read More

How to set the padding of Image using FabricJS?

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

In this tutorial, we are going to learn how to set the padding 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 padding of Image, we use the padding property. Syntax new fabric.Image( element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, { padding: Number }: Object, callback: function) Parameters ...

Read More

How to set the height of a Circle using FabricJS?

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

In this tutorial, we are going to learn how to set the height 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 manipulate a circle object by changing its position, opacity, stroke and also its dimension. FabricJS allows us to control an object's dimensions by using the width and height properties. Syntax new fabric.Circle({ height: Number }: Object) Parameters ...

Read More

How to make the controlling corners of a Triangle transparent using FabricJS?

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

In this tutorial, we are going to learn how to make the controlling corners of Triangle transparent using FabricJS. Triangle is one of the various shapes provided by FabricJS. In order to create a Triangle, we will have to create an instance of fabric.Triangle class and add it to the canvas. The transparentCorners property allows us to make the controlling corners of Triangle transparent. Syntax new fabric.Triangle( { transparentCorners: Boolean }: Object) Parameters Options (optional) − This parameter is an Object which provides ...

Read More

How to set the text alignment in IText using FabricJS?

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

In this tutorial, we are going to learn how to set the text alignment of 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 for ...

Read More

FabricJS – How to change the format of the URL string of a Line object?

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

In this tutorial, we are going to learn about how to change the format of the URL string of Line object using FabricJS. A Line element is one of the basic elements provided in FabricJS. It is used for creating straight lines. Because line elements are geometrically one-dimensional and do not contain an interior, they are never filled. We can create a line object by creating an instance of fabric.Line, specifying the x and y coordinates of the line and adding it to the canvas. In order to change the format of the URL string of Line object we use ...

Read More
Showing 271–280 of 490 articles
« Prev 1 26 27 28 29 30 49 Next »
Advertisements