There is such a javascript code:
function updateGrid() { cntx.strokeStyle = 'white'; cntx.lineCap = 'butt'; cntx.lineWidth = 1; for(var x = 0; x < canvas.width; x++) { cntx.beginPath(); cntx.moveTo(x * cellSize + move.x, move.y); cntx.lineTo(x * cellSize + move.x, canvas.width * cellSize+move.y); cntx.stroke(); cntx.closePath() } }
He is supposed to draw canvas.width
white lines, one pixel thick. But it turns out that in the screenshot:
On some forum I read that cntx.beginPath();
line cntx.beginPath();
can help cntx.beginPath();
. But without it, something even stranger is drawn:
On another forum they said that the line width may be less than one. In the following picture, the width is .0
, without the string cntx.beginPath();
:
And this is with her:
Tell me how to get rid of it?