Proprietà lineCap della tela HTML

❮ Riferimento tela HTML

Esempio

Disegna una linea con le estremità arrotondate:

Il tuo browser non supporta il canvastag HTML5.

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

Supporto del browser

I numeri nella tabella specificano la prima versione del browser che supporta completamente la proprietà.

Property
lineCap Yes 9.0 Yes Yes Yes

Definizione e utilizzo

La proprietà lineCap imposta o restituisce lo stile delle estremità finali di una linea.

Nota: i valori "tondo" e "quadrato" allungano leggermente le linee.

Valore di default: culo
sintassi JavaScript: contesto .lineCap="butt|round|square";

Valori di proprietà

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

❮ Riferimento tela HTML