xxxxxxxxxx
42
var inc = 0.01;
function setup() {
createCanvas(400, 400);
pixelDensity(1);
}
function draw() {
let yoff = 0.05;
loadPixels();
for (let y = 0; y < height; y++) {
let xoff = 3;
for (let x = 0; x < width; x++) {
let index = (x + y * width) * 4;
let r = noise(xoff, yoff*3.5, frameCount/10) * 255;
if(r < 80){
pixels[index + 0] = 115;
pixels[index + 1] = 220;
pixels[index + 2] = 251;
pixels[index + 3] = 0;
}
else if(r > 150){
pixels[index + 0] = 85;
pixels[index + 1] = 200;
pixels[index + 2] = 231;
pixels[index + 3] = 255;
}
else {
pixels[index + 0] = 115;
pixels[index + 1] = 220;
pixels[index + 2] = 251;
pixels[index + 3] = 255;
}
xoff += inc;
}
yoff += inc;
}
updatePixels();
}