HTMLキャンバスlineCapプロパティ
例
丸みを帯びたエンドキャップで線を引きます。
JavaScript:
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.lineCap = "round";
ctx.moveTo(20, 20);
ctx.lineTo(200, 20);
ctx.stroke();
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
lineCap | Yes | 9.0 | Yes | Yes | Yes |
定義と使用法
lineCapプロパティは、線のエンドキャップのスタイルを設定または返します。
注:値「round」および「square」は、線を少し長くします。
デフォルト値: | お尻 |
---|---|
JavaScript構文: | context .lineCap = "butt | round | square"; |
プロパティ値
Value | Description | Play it |
---|---|---|
butt | Default. A flat edge is added to each end of the line | |
round | A rounded end cap is added to each end of the line | |
square | A square end cap is added to each end of the line |
❮HTMLキャンバスリファレンス