Javascript Articles

Page 197 of 534

How to add stroke to a Triangle using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 221 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. Syntax new fabric.Triangle({ stroke: String }: Object) ...

Read More

How to create a canvas with Triangle using FabricJS?

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

In this tutorial, we are going to learn about how to create a canvas with a Triangle object 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. Syntax new fabric.Triangle({ width: Number, height: Number }: Object) Parameters Options (optional) − This parameter is an Object which provides additional customizations to our triangle. Using this parameter, properties such as ...

Read More

How to create a Triangle with background colour using FabricJS?

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

In this tutorial, we are going to create a Triangle with background colour 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 backgroundColor property allows us to assign a colour to our object's background. It is the colour of the container where the Triangle lives and is rectangular in shape for the triangle. Syntax new fabric.Triangle({ backgroundColor: String }: Object) Parameters ...

Read More

How to create a Triangle with border colour using FabricJS?

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

In this tutorial, we are going to create a Triangle with border colour 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. Since FabricJS is extremely flexible, we are allowed to customize our Triangle object in any way we like. One of the properties that FabricJS provides is borderColor which allows us to manipulate the colour of the border when our object is active. Syntax new fabric.Triangle({ borderColor: String }: Object) ...

Read More

How to create a Triangle with crosshair cursor on moving objects using FabricJS?

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

In this tutorial, we are going to create a Triangle with a crosshair cursor on moving objects using FabricJS. The crosshair is one of the native cursor styles available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize etc that reuse the native cursor under the hood. The moveCursor property sets the style of the cursor when the object is moved around in the canvas. This property is useful for providing visual feedback to users about the current ...

Read More

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

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

In this tutorial, we are going to create a triangle with a dash pattern border 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. We can change the appearance of the dashes of border by using the borderDashArray property. However, our triangle object must have borders enabled in order for this property to work. If the hasBorders property is assigned a false value, this property will not work. Syntax new fabric.Triangle({ ...

Read More

How to disable the centered rotation of Triangle using FabricJS?

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

In this tutorial, we are going to learn how to disable the centered rotation of 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. By default, all objects in FabricJS use their center as the point of rotation. However, we can change this behaviour by using the centeredRotation property. Syntax new fabric.Triangle({ centeredRotation: Boolean }: Object) Parameters ...

Read More

How to disable the centered scaling of a Triangle using FabricJS?

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

In this tutorial, we are going to learn how to disable the centered scaling of 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. When an object is scaled via controls, assigning a True value to the centeredScaling property makes the origin of transformation its center. By setting it to False, the scaling occurs from the corner being dragged. Syntax new fabric.Triangle({ centeredScaling: Boolean }: Object) Parameters ...

Read More

How to disable the selectability of Triangle using FabricJS?

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

In this tutorial, we are going to learn how to disable selectability of 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. In order to modify an object, we have to select it in FabricJS. However, we can disable this behaviour by using the selectable property. Syntax new fabric.Triangle({ selectable: Boolean }: Object) Parameters ...

Read More

How to flip a Triangle horizontally using FabricJS?

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

In this tutorial, we are going to learn how we can flip a Triangle object horizontally 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. We can flip a triangle object horizontally using the flipX property. Syntax new fabric.Triangle({ flipX: Boolean }: Object) Parameters Options (optional) − This parameter is an Object which provides additional customizations to our ...

Read More
Showing 1961–1970 of 5,340 articles
« Prev 1 195 196 197 198 199 534 Next »
Advertisements