我知道这个问题可能已经被回答了,但我很难弄清楚如何用我的代码来做到这一点。arc动画的Javascript动画()长度
我想要的是圆的圆弧在点击鼠标时从0deg到360deg进行绘制动画。
我知道我应该把它放在一个增加角度的循环中,但我一直在遇到(我认为)翻译问题。
这是到目前为止我的代码: https://jsfiddle.net/s7aufv0g/2/
这是我画的球:
// Draw the ball
ctx.clearRect(0,0,width,height);
ctx.save();
ctx.translate(ball.position.x, ball.position.y);
ctx.beginPath();
ctx.arc(0, 0, ball.radius, 0, Math.PI*2, true);
ctx.stroke();
ctx.closePath();
ctx.restore();
任何帮助将是巨大的,非常感谢你。
非常感谢您! – RedShift