I would like to be run an iteration of a loop every x seconds.
Every iteration will change the value of a pixel and paint the changed image to the canvas.
So far I have this:
for(let i=0;i<width;i++){ //Rows
for(o=i*(width*4);o<i*(width*4)+(width*4);o+=4){//pixels in current row
imgData.data[o] = 255
}
ctx.putImageData(imgData, xPos, yPos);
}
Which successfully changes all pixels in the image to be 255 red. However, this happens all at the same time. I would like this to happen a pixel a time every x seconds.
Any guidance?