javascript html5画布中圆弧的起始角和终止角是多少?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6746598/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is start angle and end angle of arc in html5 canvas?
提问by mr_eclair
I'm learning HTML5 and I"m stuck on arc.
我正在学习 HTML5,但我被困在了弧线上。
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?
我没有完美地得到这个 startAngle,endAngle 这两个参数是如何计算来绘制不同类型的圆、弧的?
回答by Sarath
This method takes Sixparameters:
该方法需要六个参数:
- x and y are the coordinates of the circle's center.
- Radius is self explanatory.
- The startAngleand endAngleparameters 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.
- x 和 y 是圆心的坐标。
- 半径是不言自明的。
- 在由startAngle和endAngle参数定义弧度圆弧的起点和终点。起始角和闭合角是从 x 轴测量的。
- 逆时针参数是一个布尔值,当为 true 时,逆时针绘制弧线,否则沿顺时针方向绘制。
For better understanding of startAngle and endAngle
为了更好地理解 startAngle 和 endAngle
http://www.html5canvastutorials.com/tutorials/html5-canvas-arcs/
http://www.html5canvastutorials.com/tutorials/html5-canvas-arcs/
回答by Simon Sarris
回答by Sophie cai
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.
我查看了一些答案,并且对度数和弧度感到非常困惑,所以当我使用 html5 画布进行测试时,我绘制了一个图像。希望这篇可以帮助您轻松理解。
If you are more familiar with number than formulas with PI,then The answer to put in the parameter is simply between 0-6.2831approximately (2π,360°)
如果您更熟悉数字而不是 PI 公式,那么输入参数的答案只是在0-6.2831之间大约 (2π,360°)