xxxxxxxxxx
32
let colors = [];
let cols; let rows; let size = 10;
let xoff = 0; let yoff = 0;
let inc = 0.1;
function setup() {
createCanvas(400, 400);
cols = width/size;
rows = height/size;
for (let i=0; i<cols; i++){
noStroke();
xoff += inc;
colors[i] = [];
yoff = 0;
for (let j=0; j<rows; j++){
colors[i][j] = noise(xoff, yoff)*255;
yoff += inc;
}
}
}
function draw() {
background(220);
for (let i=0; i<cols; i++){
for (let j=0; j<rows; j++){
fill(colors[i][j]);
rect(i*size, j*size, size, size);
}
}
}