Canvas lineCap attribute
Definition and usage
lineCap
Set or return the style of the line end hat.
注释:"round
Atsquare
" ay magiging mas mahaba ang linya.
Example
Ilang katapusan ng punggol na line:
JavaScript:
var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.beginPath(); ctx.lineCap="round"; ctx.moveTo(20,20); ctx.lineTo(20,200); ctx.stroke();
Syntax
context.lineCap="butt|round|square";
Attribute value
Value | Description |
---|---|
butt | Default. Magdagdag ng patag na gilid sa bawat pahaba ng linya. |
round | Sa bawat pahaba ng linya, magdagdag ng punggol na line hat. |
square | 向线条的每个末端添加正方形线帽。 |
技术细节
默认值: | butt |
---|
浏览器支持
表中的数字注明了首个完全支持该属性的浏览器版本。
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.6 | 4.0 | 10.1 |
注释:Internet Explorer 8 以及更早的版本不支持 <canvas> 元素。