طريقة HTML Canvas arc ()

❮ مرجع قماش HTML

مثال

قم بإنشاء دائرة:

لا يدعم متصفحك HTML5canvastag.

جافا سكريبت:

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(100, 75, 50, 0, 2 * Math.PI);
ctx.stroke();

دعم المتصفح

تحدد الأرقام الواردة في الجدول إصدار المتصفح الأول الذي يدعم الطريقة بالكامل.

Method
arc() Yes 9.0 Yes Yes Yes

التعريف والاستخدام

طريقة القوس () تنشئ قوسًا / منحنىًا (تُستخدم لإنشاء دوائر أو أجزاء من الدوائر).

نصيحة: لإنشاء دائرة بها قوس (): اضبط زاوية البداية على 0 وزاوية النهاية على 2 * Math.PI.

نصيحة: استخدم طريقة الحد () أو طريقة التعبئة () لرسم القوس على اللوحة القماشية.

قوس

مركز
القوس ( 100،75 ، 50،0 * Math.PI، 1.5 * Math.PI)
زاوية البداية
قوس (100،75،50، 0 ، 1.5 * Math.PI)
زاوية النهاية
القوس (100،75،50،0 * Math.PI ، 1.5 * Math.PI )

بناء جملة JavaScript: السياق .arc ( x ، y ، r ، sAngle ، eAngle ، عكس اتجاه عقارب الساعة ) ؛

قيمه المعامل

Parameter Description Play it
x The x-coordinate of the center of the circle
y The y-coordinate of the center of the circle
r The radius of the circle
sAngle The starting angle, in radians (0 is at the 3 o'clock position of the arc's circle)
eAngle The ending angle, in radians
counterclockwise Optional. Specifies whether the drawing should be counterclockwise or clockwise. False is default, and indicates clockwise, while true indicates counter-clockwise.

❮ مرجع قماش HTML