HTML-Leinwand ARCTO () -Methode
Beispiele
Auf der Leinwand einen Lichtbogen zwischen zwei Tangenten zwischen zu erstellen:
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
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
Versuchen »
Browser-Unterstützung
Internet Explorer 9, Firefox, Chrome und Safari unterstützen ARCTO () -Methode.
Hinweis: Opera nicht unterstützt ARCTO () -Methode.
Hinweis: 8 und frühere Versionen von Internet Explorer unterstützt nicht das <canvas> -Element.
Definition und Verwendung
ARCTO () -Methode erstellt zwischen Bogen / Kurve zwischen zwei Tangenten auf der Leinwand.
Tipp: Verwenden Sie den Hub () Methode präzise Bögen auf der Leinwand zu zeichnen.
JavaScript-Syntax: | Kontext .arcTo (x1, y1, x2, y2, r); |
---|
Parameter Wert
参数 | 描述 |
---|---|
x1 | 弧的起点的 x 坐标。 |
y1 | 弧的起点的 y 坐标。 |
x2 | 弧的终点的 x 坐标。 |
y2 | 弧的终点的 y 坐标。 |
r | 弧的半径。 |