HTMLキャンバスarcTo()メソッド

❮HTMLキャンバスリファレンス

キャンバス上の2つの接線の間に円弧を作成します。

あなたのブラウザはHTML5canvastagをサポートしていません。

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

ブラウザのサポート

表の数字は、このメソッドを完全にサポートする最初のブラウザバージョンを示しています。

Method
arcTo() Yes 9.0 Yes Yes No

定義と使用法

arcTo()メソッドは、キャンバス上の2つの接線の間に円弧/曲線を作成します。

キャンバスarcto()図

ヒント:stroke()メソッドを使用して、実際にキャンバスに円弧を描画します。

JavaScript構文: コンテキスト.arcTo(x1、y1、x2、y2、r);

パラメータ値

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

❮HTMLキャンバスリファレンス