I am trying to make a grid on my 500px x 500px canvas:
<canvas id="area" style="width: 500px; height: 500px;"></canvas>
var canvas = document.getElementById('area');
var context = canvas.getContext('2d');
for (var x = 0.5; x < 500; x += 10) {
context.moveTo(x, 0);
context.lineTo(x, 500);
}
for (var y = 0.5; y < 500; y += 10) {
context.moveTo(0, y);
context.lineTo(500, y);
}
context.strokeStyle = "#eee";
context.stroke();
The code looks correct to me but for some reason its coming out elongated and pixelated:
Would anyone know why this occurring?