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:
html
Output:
Example 2: This example illustrates the bevel linejoin property.
html
Output:
Example 3: This example illustrates the round linejoin property.
html
Output:
Supported Browsers: The browser supported by HTML canvas lineJoin property are listed below:
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.
<!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>
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>
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>
Supported Browsers: The browser supported by HTML canvas lineJoin property are listed below:
- Google Chrome
- Internet Explorer 9.0
- Firefox
- Safari
- Opera