HTML | canvas lineJoin Property
The HTML canvas lineJoin property is used to set or return the type of corner created, when two lines meet, by using the lineJoin property. The type of join can have one of three styles: bevel, round, or miter. However, the join style has generally miter style.
Syntax:
context.lineJoin = "bevel|round|miter";
Property Values:
- miter: It is the default style. This value is used to design a sharp corner.
- bevel: This design is used to create beveled corner.
- round: This design is used to create rounded corner.
Example 1: This example illustrates the miter linejoin property.
<!DOCTYPE html> <html> <head> <title> HTML canvas lineJoin property </title> </head> <body style="text-align:center;"> <h1 style="color:green"> GeeksforGeeks </h1> <h2> HTML canvas lineJoin property </h2> <canvas id="canvas" width="350" height="380"></canvas> <script> var can = document.getElementById("canvas"); var context = can.getContext("2d"); context.beginPath(); context.lineWidth = 20; context.lineJoin = "miter"; context.moveTo(80, 250); context.lineTo(150, 50); context.lineTo(250, 240); context.strokeStyle ="green"; context.stroke(); </script> </body> </html> |
Output:

Example 2: This example illustrates the bevel linejoin property.
<!DOCTYPE html> <html> <head> <title> HTML canvas lineJoin property </title> </head> <body style="text-align:center;"> <h1 style="color:green"> GeeksforGeeks </h1> <h2> HTML canvas lineJoin property </h2> <canvas id="canvas" width="350" height="380"></canvas> <script> var can = document.getElementById("canvas"); var context = can.getContext("2d"); context.beginPath(); context.lineWidth = 20; context.lineJoin = "bevel"; context.moveTo(80, 250); context.lineTo(150, 50); context.lineTo(250, 240); context.strokeStyle ="green"; context.stroke(); </script> </body> </html> |
Output:

Example 3: This example illustrates the round linejoin property.
<!DOCTYPE html> <html> <head> <title> HTML canvas lineJoin property </title> </head> <body style="text-align:center;"> <h1 style="color:green"> GeeksforGeeks </h1> <h2> HTML canvas lineJoin property </h2> <canvas id="canvas" width="350" height="380"></canvas> <script> var can = document.getElementById("canvas"); var context = can.getContext("2d"); context.beginPath(); context.lineWidth = 20; context.lineJoin = "round"; context.moveTo(80, 250); context.lineTo(150, 50); context.lineTo(250, 240); context.strokeStyle ="green"; context.stroke(); </script> </body> </html> |
Output:

Supported Browsers: The browser supported by HTML canvas lineJoin property are listed below:
- Google Chrome
- Internet Explorer 9.0
- Firefox
- Safari
- Opera
Recommended Posts:
- HTML | canvas fillStyle Property
- HTML | canvas globalAlpha Property
- HTML | canvas textAlign Property
- HTML | canvas lineCap Property
- HTML | canvas shadowOffsetX Property
- HTML | canvas shadowBlur Property
- HTML | canvas strokeStyle Property
- HTML | canvas textBaseline Property
- HTML | canvas shadowColor Property
- HTML | canvas lineWidth Property
- HTML | canvas miterLimit Property
- HTML | canvas font Property
- HTML | canvas shadowOffsetY Property
- HTML | canvas ImageData data Property
- HTML | canvas ImageData height Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



