Метод arcTo() холста HTML
Пример
Создайте дугу между двумя касательными на холсте:
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() | 4.0 | 9.0 | 3.6 | 4.0 | Not supported |
Определение и использование
Метод arcTo() создает дугу/кривую между двумя касательными на холсте.
Совет: используйте метод stroke() , чтобы на самом деле нарисовать дугу на холсте.
Синтаксис JavaScript: | контекст .arcTo( x1, y1, x2, y2, r ); |
---|
Значения параметров
Parameter | Description | Play it |
---|---|---|
x1 | The x-coordinate of the beginning of the arc | |
y1 | The y-coordinate of the beginning of the arc | |
x2 | The x-coordinate of the end of the arc | |
y2 | The y-coordinate of the end of the arc | |
r | The radius of the arc |
❮ Объект холста