小编use*_*930的帖子

如何计算圆弧起点和终点的精确点位置

我想通过计算找到弧的终点和起点。

你可以输入

范围半径: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)

html javascript canvas

2
推荐指数
1
解决办法
2288
查看次数

标签 统计

canvas ×1

html ×1

javascript ×1