我正在尝试在画布中创建一个弧,我想使用度数,而不是弧度。问题是它不是从 12 点开始,而是从 3 点开始,就像文档说的那样,但是我怎样才能强制它到 12 点呢?
JsFiddle:http: //jsfiddle.net/C8CXz/
function degreesToRadians (degrees) {
return degrees * (Math.PI/180);
}
function radiansToDegrees (radians) {
return radians * (180/Math.PI);
}
var canvas = document.getElementById('circle');
var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.arc(80, 80, 50, degreesToRadians(0), degreesToRadians(180), false);
ctx.lineWidth = 10;
ctx.stroke();