HTML canvas miterLimit Property
Example
// Accessing the element
let c = document.getElementById("myCanvas");
// Styling canvas
let ctx = c.getContext("2d");
ctx.lineWidth = 5;
ctx.lineJoin = "miter";
ctx.miterLimit = 5;
ctx.moveTo(25, 25);
ctx.lineTo(125, 75);
ctx.lineTo(25, 125);
ctx.stroke();
Meaning
The miterLimit canvas property sets or returns the maximum miter length.
Note: The miterLimit property works only if the lineJoin attribute is "miter".
Standard Syntax
Default value:
10
JavaScript syntax:
context.miterLimit=number;
Advertisement
Property Values
| Value | Description |
|---|---|
| number | Specifies a positive number that specifies the maximum miter length. If the current miter length exceeds the miterLimit, the corner will display as lineJoin "bevel". |