我知道這個問題可能已經被回答了,但我很難弄清楚如何用我的代碼來做到這一點。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