javascript - Why do white lines appear in my canvas when rendered on my iPad (Safari and Chrome)? -
I am updating a line with a canvas while using JS. On my laptop, the canvas renders the canvas as expected, whenever I refresh, white horizontal lines are displayed in the canvas on different lines in every row. I
If I zoom in or out on my iPad then the lines get out why this is happening but any thoughts and how can I work around it? I have tried to overwhelm the browser window again through several ways. It has not changed anything.
Here is the code:
function pentrev (y) {if (y == 100) return; Var c = document.getElementById ("myCanvas"); Var ctx = c.getContext ("2D"); Var image data = ctx.createImageData (100, 1); Var i = 0; {ImageData.data [i] = x / 100 * 255 for (x = 0; x <100; x ++); ImageData.data [i + 1] = 0; ImageData.data [i + 2] = 0; ImageData.data [i + 3] = 255; I + = 4} ctx.putImageData (image data, 0, Y); SetTimeout (function () {paintRow (y + 1);}, 10); } Pentro (0);
Here is an alternative solution that appears to work:
c.style.zoom = c.style.zoom == "100%"? "100.0001%": "100%";
After each update.
Comments
Post a Comment