1

Everytime I try to make a circle by this method (where board is the canvas board which has the context of 2d):

        board.lineWidth = 4;
        board.beginPath();
        board.arc(canvas.width/2, canvas.height/2, 10,0,360);
        board.strokeStyle = "blue";
        board.stroke();
        board.closePath();

It always created more of a ellipse than a circle and it never go by the coordinates I give it. If I say canvas.width/2 and with height (to center it) it even goes outside the canvas itself. When I give it something else like 30 it goes much further than 30 pixels aswell.

Sidenote: My width and height of my canvas are both 500 pixels.

Axeowny
  • 21
  • 7

1 Answers1

1

5th parameter of arc expected to be an angle in radians, not degrees.

360 degrees = 2 * PI

So you have to change your code to:

...
board.arc(canvas.width/2, canvas.height/2, 10, 0, Math.PI * 2);
hindmost
  • 7,125
  • 3
  • 27
  • 39