Canvas lineWidth eigenschap
Definitie en gebruik
lineWidth
Stelt in of retourneert de breedte van de huidige lijn in pixels.
Voorbeeld
Teken een rechthoek met een lijn van 10 pixels breedte:
JavaScript:
var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.lineWidth=10; ctx.strokeRect(20,20,80,100);
语法
context.lineWidth=number;
Attribute value
Value | Description |
---|---|
number | The current line width in pixels. |
Technical details
Default value: | 1 |
---|
Browser support
The numbers in the table indicate the first browser version that fully supports this property.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.6 | 4.0 | 10.1 |
Note:Internet Explorer 8 and earlier versions do not support the <canvas> element.