/

HTML / CSS / JavaScript Tutorial

JavaScript canvas2d object method: arc()

[this page | pdf | back links]

The arc() method of the JavaScript DOM object returned by the getContext("2d") method applied to the HTML <canvas> element creates a circular arc.

 

It has the following syntax with the following parameters.

 

context.arc(x, y, r, startAngle, endAngle, counterclockwise)

 

Parameter

Required / Optional

Description

x

Required

x-coordinate or circle centre

y

Required

y-coordinate or circle centre

r

Required

Radius of circle

startAngle

Required

Start angle of arc in radians from x-axis

endAngle

Required

End angle of arc in radians from x-axis

counterclockwise

Optional

(default is false). Boolean, if true then draw arc counterclockwise, otherwise clockwise

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile