我想通过计算找到弧的终点和起点。
你可以输入
范围半径:150
范围起始角度:60
范围结束角度:160
请参阅演示 jsFiddle
非常感谢
function draw(val,StartAngle,EndAngle,XAxis,YAxis){
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d'),
x = 200,//center raduis
y = 400;//center raduis
d = EndAngle;//End Angle
s = StartAngle;//Start angle
X_Axis = XAxis;//feature to enable to move the circle on axis X
Y_Axis = YAxis;// feature to enable to move the circle on axis Y
p ={}
p.r = val;
p.d = d*2*Math.PI/360;
p.s = s*2*Math.PI/360;
p.x = X_Axis + p.d*Math.cos(p.r);
p.y = Y_Axis …Run Code Online (Sandbox Code Playgroud)