Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML canvas lineJoin attribute

HTML canvas lineJoin attribute

Canvas Object Reference Canvas object

Example

Create a rounded corner when two lines meet:

YourbrowserdoesnotsupporttheHTML5canvastag.

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();

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 9, Firefox, Opera, Chrome and Safari support the lineJoin attribute.

**Note:** Internet Explorer 8 and earlier versions do not support .


Definition and Usage

The lineJoin attribute sets or returns the type of corner created when two lines meet.

Note:The "miter" value is affected by the miterLimit attribute.

Default value: miter
JavaScript syntax: context.lineJoin="bevel|round|miter";

Attribute values

Value Description
bevel Creates a bevel.
round Creates a rounded corner.
miter Default. Creates a sharp corner (miter).

Canvas Object Reference Canvas object