Metodo HTML canvas arcTo()

❮ Riferimento tela HTML

Esempio

Crea un arco tra due tangenti sulla tela:

Il tuo browser non supporta il canvastag HTML5.

JavaScript:

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(20, 20);           // Create a starting point
ctx.lineTo(100, 20);          // Create a horizontal line
ctx.arcTo(150, 20, 150, 70, 50); // Create an arc
ctx.lineTo(150, 120);         // Continue with vertical line
ctx.stroke();                // Draw it

Supporto browser

I numeri nella tabella specificano la prima versione del browser che supporta completamente il metodo.

Method
arcTo() Yes 9.0 Yes Yes No

Definizione e utilizzo

Il metodo arcTo() crea un arco/curva tra due tangenti sulla tela.

Diagramma arcto() della tela

Suggerimento: usa il metodo stroke() per disegnare effettivamente l'arco sulla tela.

sintassi JavaScript: contesto .arcTo( x1,y1,x2,y2,r );

Valori dei parametri

Parameter Description Play it
x1 The x-coordinate of the first tangent
y1 The y-coordinate of the first tangent
x2 The x-coordinate of the second tangent
y2 The y-coordinate of the second tangent
r The radius of the arc

❮ Riferimento tela HTML