Found 566 Articles for FabricJS

How to add stroke to a Triangle using FabricJS?

Rahul Gurung
Updated on 24-Jun-2022 12:08:36

98 Views

In this tutorial, we are going to learn how to add stroke to a Triangle 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.Our triangle object can be customized in various ways like changing its dimensions, adding a background colour or by changing the colour of the line drawn around the object. We can do this by using the stroke property.Syntaxnew fabric.Triangle({ stroke : String }: Object)ParametersOptions (optional) − This parameter is an Object which provides ... Read More

How to add shadow to a Triangle using FabricJS?

Rahul Gurung
Updated on 24-Jun-2022 12:03:04

70 Views

In this tutorial, we are going to learn how to add a shadow to a Triangle 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.Our triangle object can be customized in various ways like changing its dimensions, adding a background color or even adding a shadow to it. We can add a shadow to the triangle by using the shadow property.Syntaxnew fabric.Triangle({ shadow : fabric.Shadow }: Object)ParametersOptions (optional) − This parameter is an Object which provides ... Read More

How to add dashed stroke to a Triangle using FabricJS?

Rahul Gurung
Updated on 24-Jun-2022 11:55:22

80 Views

In this tutorial, we are going to learn how to add a dashed stroke to a Triangle 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 strokeDashArray property allows us to specify a dash pattern for the object's stroke.Syntaxnew fabric.Triangle( { strokeDashArray: Array }: Object)Parametersoptions (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 of other properties can ... Read More

How to lock the vertical movement of a Rectangle using FabricJS?

Rahul Gurung
Updated on 24-Jun-2022 09:04:52

88 Views

In this tutorial, we are going to learn how to lock the vertical movement of a Rectangle using FabricJS. Just as we can specify the position, colour, opacity and dimension of a rectangle object in the canvas, we can also specify whether we want it to move only in the X-axis. This can be done by using the lockMovementY property.Syntaxnew fabric.Rect({ lockMovementY: Boolean }: Object)Parametersoptions (optional) − This parameter is an Object which provides additional customizations to our rectangle. Using this parameter, properties such as colour, cursor, stroke width and a lot of other properties can be changed related to ... Read More

How to create a Rectangle with dash pattern border using FabricJS?

Rahul Gurung
Updated on 24-Jun-2022 08:42:10

380 Views

In this tutorial, we are going to create a rectangle with a dash pattern border using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas.We can change the appearance of the dashes of border, by using the borderDashArray property. However, our rectangle object must have borders in order for this property to work. If the hasBorders property is assigned a False value, this property will not work.Syntaxnew fabric.Rect({ borderDashArray: Array }: Object)Parametersoptions (optional) − This parameter ... Read More

How to set the width of stroke of Circle using FabricJS?

Rahul Gurung
Updated on 27-May-2022 08:11:40

190 Views

In this tutorial, we are going to learn how to add a dashed stroke to a Circle 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. The strokeWidth property allows us to specify the width of a stroke for an object.Syntaxnew fabric.Circle( { strokeWidth: Number }: Object)Parametersoptions (optional) − This parameter is an Object which provides additional customizations to our circle. Using this parameter, properties such as colour, cursor, stroke width and a lot of ... Read More

How to set the vertical scale factor of Circle using FabricJS?

Rahul Gurung
Updated on 27-May-2022 08:05:37

118 Views

In this tutorial, we are going to learn how to set the vertical scale factor of a Circle 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. Just as we can specify the position, colour, opacity and dimension of a circle object in the canvas, we can also set the vertical scale of a circle object. This can be done by using the scaleY property.Syntaxnew fabric.Circle({ scaleY : Number }: Object)Parametersoptions (optional) − This parameter ... Read More

How to set the style of controlling corners of a Circle using FabricJS?

Rahul Gurung
Updated on 27-May-2022 07:58:12

452 Views

In this tutorial, we are going to learn how to set the style of controlling corners of Circle 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.The controlling corners of an object allow us to scale, stretch or change its position. We can customize our controlling corners in many ways such as adding a specific colour to it, changing its size etc. We can change the style by using the cornerStyle property.Syntaxnew fabric.Circle({ cornerStyle: String ... Read More

How to set the size of the controlling corners of a Circle using FabricJS?

Rahul Gurung
Updated on 27-May-2022 07:52:29

426 Views

In this tutorial, we are going to learn how to set the size of the controlling corners of a Circle using FabricJS. The controlling corners of an object allow us to scale, stretch or change its position. We can customize our controlling corners in many ways such as adding a specific colour to it, changing its size etc. We can change the size by using the cornerSize property.Syntaxnew fabric.Circle({ cornerSize: Number }: Object)Parametersoptions (optional) − This parameter is an Object which provides additional customizations to our circle. Using this parameter, properties such as colour, cursor, stroke width and a lot ... Read More

How to set the scale factor (border) of a Circle using FabricJS?

Rahul Gurung
Updated on 27-May-2022 07:45:28

171 Views

In this tutorial, we are going to set the scale factor (border) of 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 use the borderScaleFactor property which specifies the scale factor of objects controlling borders.Syntaxnew fabric.Circle({ borderScaleFactor: Number }: Object)Parametersoptions (optional) − This parameter is an Object which provides additional customizations to our circle. Using this parameter, properties such as colour, cursor, stroke width and a lot of other properties can be changed ... Read More

Advertisements