xxxxxxxxxx
35
let counter = 0;
const perloop = 20;
function setup() {
createCanvas(500,500);
}
function draw() {
loadPixels();
let d = pixelDensity();
let img = 4 * (width * d) * (height * d);
let thing = millis()*0.0002
for (let i = 0; i < img; i += 4*perloop) {
let index = i/4/d;
let y = index/(width*d);
let x = index%(width*2)
let val = noise(0.5*x/width,0.5*y/height,thing)*255
if(val<127){val=0;}
else {val=255;}
for(let k=0;k<perloop;k++){
for(let j=0;j<3;j++){
pixels[i+4*k+j] = val;
}
pixels[i+4*k + 3] = 256;
}
}
updatePixels();
counter++;
if(counter>10){
print(frameRate());
counter = 0;
}
}