HTML कैनवास आर्क () विधि
उदाहरण
एक मंडली बनाएं:
जावास्क्रिप्ट:
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 )
जावास्क्रिप्ट सिंटैक्स: | संदर्भ .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 कैनवास संदर्भ