Found 566 Articles for FabricJS

How to add dashed stroke to a Rectangle using FabricJS?

Rahul Gurung
Updated on 28-Jun-2022 12:10:15

550 Views

In this tutorial, we are going to learn how to add a dashed stroke to a Rectangle 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. The strokeDashArray property allows us to specify a dash pattern for the object's stroke.Syntaxnew fabric.Rect( { strokeDashArray: Array }: Object)ParametersOptions (optional) − This parameter is an Object which provides additional customizations to our rectangle. Using this parameter colour, cursor, stroke width and a lot of other properties can be ... Read More

How to add curves to a Rectangle using FabricJS?

Rahul Gurung
Updated on 28-Jun-2022 11:54:45

1K+ Views

In this tutorial, we are going to learn how to add curves to a Rectangle 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 customize a rectangle object by specifying its position, colour, opacity and dimension. However, we can also use properties like rx and ry which allow us to assign the horizontal and vertical border radius of a Rectangle.Syntaxnew fabric.Rect({ rx : Number, ry: Number }: Object)ParametersOptions (optional) − This parameter is an ... Read More

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

Rahul Gurung
Updated on 30-Jun-2022 14:45:35

379 Views

In this tutorial, we are going to learn how to set the width of stroke of a Rectangle 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.The strokeWidth property allows us to specify the width of a stroke for an object.Syntaxnew fabric.Rect( { strokeWidth: Number }: 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 ... Read More

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

Rahul Gurung
Updated on 30-Jun-2022 14:44:19

99 Views

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

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

Rahul Gurung
Updated on 30-Jun-2022 14:42:55

121 Views

In this tutorial, we are going to learn how to set the style of controlling corners of Rectangle 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.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.Rect({ cornerStyle: String ... Read More

How to set the size of the controlling corners of Rectangle using FabricJS?

Rahul Gurung
Updated on 30-Jun-2022 14:41:49

222 Views

In this tutorial, we are going to learn how to set the size of the controlling corners of a Rectangle 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.Rect({ cornerSize: Number }: 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 ... Read More

How to set the position of Rectangle from top using FabricJS?

Rahul Gurung
Updated on 30-Jun-2022 14:40:21

297 Views

In this tutorial, we are going to set the position of Rectangle using FabricJS. The top property allows us to manipulate the position of the object. By default, the top position is relative to the object’s top.Syntaxnew fabric.Rect({ top: Number }: 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 the object of which the top is a property.Options keystop − This property accepts a Number which allows us to set the top ... Read More

How to set the padding of a Rectangle using FabricJS?

Rahul Gurung
Updated on 30-Jun-2022 14:37:35

472 Views

In this tutorial, we are going to learn how to set the padding of a Rectangle 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.Just as we can specify the position, colour, opacity and dimension of a rectangle object in the canvas, we can also set the padding of a rectangle object. This can be done by using the padding property.Syntaxnew fabric.Rect({ padding : Number }: Object)ParametersOptions (optional) − This parameter is an Object which ... Read More

How to set the opacity of a Rectangle using FabricJS?

Rahul Gurung
Updated on 30-Jun-2022 14:35:25

314 Views

In this tutorial, we are going to learn how to set the opacity of Rectangle 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 customize a rectangle object by adding a fill colour to it, eliminate its borders or even make changes in its dimensions. Similarly, we can also change its opacity by using the opacity property.Syntaxnew fabric.Rect({ opacity: Number }: Object)ParametersOptions (optional) − This parameter is an Object which provides additional customizations to ... Read More

How to set the horizontal scale factor of a Rectangle using FabricJS?

Rahul Gurung
Updated on 30-Jun-2022 13:30:43

188 Views

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

Advertisements