xxxxxxxxxx
42
let cols = 20; let rows = 20; let size = 10;
let sizes = [];
let xoff = 0; let yoff = 0; let zoff = 0;
let inc = 0.1;
function setup() {
createCanvas(400, 400, WEBGL);
// cols = width/size;
// rows = height/size;
angleMode(DEGREES);
}
function draw() {
background(220);
rotateX(-45);
rotateY(45);
xoff = 0;
// noStroke();
let r = noise(zoff + 15) * 255;
let g = noise(zoff + 30) * 255;
let b = noise(zoff + 45) * 255;
fill(r, g, b);
for (let i=0; i<cols; i++) {
sizes[i] = [];
yoff = 0;
for (let j=0; j<rows; j++) {
sizes[i][j] = map(noise(xoff, yoff, zoff), 0 , 1, 0, 100);
push();
translate(i*size - (size*cols)/2, 0, j*size - (size*rows)/2);
box(size, sizes[i][j], size);
pop();
yoff += inc;
}
xoff += inc;
zoff += 0.0007;
}
}