HTML canvas lineJoin attribute

Definition and usage

lineJoin The property sets or returns the type of the created corner when two lines intersect.

注释:The value "miter" is affected by miterLimit The influence of properties.

Example

When two lines intersect, create circular corners:

Your browser does not support the canvas tag.

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

亲自试一试

语法

context.lineJoin="bevel|round|miter";

属性值

描述
bevel 创建斜角。
round 创建圆角。
miter 默认。创建尖角。

技术细节

默认值: miter

浏览器支持

表中的数字注明了首个完全支持该属性的浏览器版本。

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
4.0 9.0 3.6 4.0 10.1

注释:Internet Explorer 8 以及更早的版本不支持 <canvas> 元素。