N
N
Nikolay Erofeev2015-06-14 21:45:42
JavaScript
Nikolay Erofeev, 2015-06-14 21:45:42

How to draw correct circle on canvas?

Hello, I'm new to canvas. In general, there is a block, width 80% relative to the window, height 400px. Inside the canvas, with a width and height of 100%. drew a circle

ctx.beginPath();
  ctx.arc(50, 50, 50, 0, 2 * Math.PI, false);
  ctx.stroke();

it turned out
fdd1c5f353d74b168f3c6aab57006b1a.png
Why so? ps but when saving the drawing, it renders the correct circle.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2015-06-14
@Mackaybravo

but when saving the drawing, it renders the correct circle.

The canvas needs to be pulled not with styles, but through setting width and height

T
twobomb, 2015-06-15
@twobomb

https://jsfiddle.net/o918pe7w/2/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question