Cocos Creator
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 control point. |
y | The y coordinate of the center control point. |
r | Arc radian. |
startAngle | Start radian, measured clockwise from positive x axis. |
endAngle | End radian, measured clockwise from positive x axis. |
counterclockwise | Determines the drawing direction. Clockwise when set to false (default).Counterclockwise when set to true . |
Example
ts
const ctx = node.getComponent(Graphics);
ctx.arc(100,75,50,0,1.5 * Math.PI);
ctx.stroke();
Return to the Graphics Component Reference documentation.