Arc
The arc()
method creates an arc/curve (used to create circles or partial circles).
Note: To create a circle with
arc()
, set the start angle to0
and the end angle to2 * Math.PI
.
Parameter | Description |
---|---|
x | The x coordinate of the center of the circle. |
y | The y coordinate of the center of the circle. |
r | Radius of the circle. |
sAngle | Start angle in radians (The arc's three o'clock position is 0 degrees). |
eAngle | End angle in radians. |
counterclockwise | Optional. Specifies whether draw the arc counterclockwise or clockwise. False = clockwise, true = counterclockwise. |
Example
var ctx = node.getComponent(cc.GraphicsComponent);
ctx.arc(100,75,50,0,1.5 * Math.PI);
ctx.stroke();
Return to the Graphics Component Reference documentation.