Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is start angle and end angle of arc in html5 canvas?

I'm learning HTML5 and I"m stuck on arc.

syntax

arc(x, y, radius, startAngle, endAngle, anticlockwise)

I'm not getting this startAngle,endAngle perfectly how this two parameters are calculated to draw different types of circles,arcs?

like image 582
Vishwanath Dalvi Avatar asked Jul 19 '11 11:07

Vishwanath Dalvi


2 Answers

This method takes Six parameters:

  • x and y are the coordinates of the circle's center.
  • Radius is self explanatory.
  • The startAngle and endAngle parameters define the start and end points of the arc in radians. The starting and closing angle are measured from the x axis.
  • The anticlockwise parameter is a boolean value which when true draws the arc anticlockwise, otherwise in a clockwise direction.

For better understanding of startAngle and endAngle

http://www.html5canvastutorials.com/tutorials/html5-canvas-arcs/

http://www.html5canvastutorials.com/wp-content/uploads/2010/11/html5_canvas_arc6.png

like image 163
Sarath Avatar answered Oct 20 '22 18:10

Sarath


They are radians, not degrees.

Some good examples

like image 33
Simon Sarris Avatar answered Oct 20 '22 18:10

Simon Sarris