I'm learning HTML5 and I"m stuck on arc.
syntax
arc(x, y, radius, startAngle, endAngle, anticlockwis开发者_如何学Ce)
I'm not getting this startAngle,endAngle perfectly how this two parameters are calculated to draw different types of circles,arcs?
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/
They are radians, not degrees.
Some good examples
I looked into a few answers and was very confused by degrees and radians so I drew an image when I tested using html5 canvas. Hope this one help you understand easily.
If you are more familiar with number than formulas with PI,then The answer to put in the parameter is simply between 0-6.2831 approximately (2π,360°)
and it doesn't take either "π" or degrees(180°)
精彩评论