arc method
Adds points to a path that represents an arc.
Syntax
object.arc(x, y, radius, startAngle, endAngle, anticlockwise);
Parameters
x [in]
Type: number
The x-coordinate, in pixels, for the center point of the arc in relation to the upper-left corner of the canvas rectangle.
y [in]
Type: number
The y-coordinate, in pixels, for the center point of the arc in relation to the upper-left corner of the canvas rectangle.
radius [in]
Type: number
The radius or distance from the point (x,y) that the arc's path follows.
startAngle [in]
Type: number
The starting angle, in radians, where 0 is at the 3 o'clock position of the arc's circle.
endAngle [in]
Type: number
The ending angle, in radians.
anticlockwise [in]
Type: BOOL
true
The arc is drawn in a counterclockwise direction from start to end.
false
The arc is drawn in a clockwise direction from start to end.
Return value
This method does not return a value.
Exceptions
Exception | Condition |
---|---|
IndexSizeError | The specified radius value is negative. |
Standards information
- HTML Canvas 2D Context, Section 9
Remarks
If the startAngle and endAngle angles are equal, the ICanvasRenderingContext2D::arc method creates a circle. To convert degrees to radians use the following formula.
var radians = degrees * Math.PI/180