HTML canvas lineJoinProperty
Example
Create rounded corners when two lines meet:
JavaScript:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.lineJoin="round";
ctx.moveTo(20,20);
ctx.lineTo(100,50);
ctx.lineTo(20,100);
ctx.stroke();
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.lineJoin="round";
ctx.moveTo(20,20);
ctx.lineTo(100,50);
ctx.lineTo(20,100);
ctx.stroke();
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
Internet Explorer 9, Firefox, Opera, Chrome, and Safari support the lineJoin property.
Note:Internet Explorer 8 and earlier versions do not support the <canvas> element.
Definition and Usage
The lineJoin property sets or returns the type of corner created when two lines meet.
Note:The "miter" value is affected by themiterLimitproperty.
| Default value: | miter |
|---|---|
| JavaScript syntax: | context.lineJoin="bevel|round|miter"; |
Property Values
| Value | Description |
|---|---|
| bevel | Creates a bevel. |
| round | Creates a round corner. |
| miter | Default. Creates a sharp corner. |
HTML canvas Reference Other extensions