xxxxxxxxxx
38
let rWidth = 2;
function setup() {
createCanvas(400, 400);
background(220, 20, 120);
noStroke();
}
function draw() {
drawNoise();
}
function drawNoise() {
for (let y = 0; y < height; y += rWidth) {
for (let x = 0; x < width; x += rWidth) {
let c = 255 * noise(frameCount / 10 + x / 180, y / 150);
if (c > 150) {
fill("forestgreen");
} else if (c > 130) {
fill("sandybrown");
} else if (c > 120) {
fill("saddlebrown");
} else if (c > 80) {
fill("dodgerblue");
} else {
fill("darkblue");
}
rect(x, y, rWidth, rWidth);
}
}
}
function mouseClicked() {
drawNoise();
}