xxxxxxxxxx
let angle = 0;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
background(0);
stroke(100);
}
function draw() {
background(0);
perspective();
// ortho();
// directionalLight(255,255,255,0,-1,0); // (color, direction)
// ambientLight(255,255,255,0,-1,0); // (color, direction)
translate(0,50,-50);
rotateX(-QUARTER_PI);
rotateY(atan(1/sqrt(2)));
// rectMode(CENTER);
// rotateX(angle/4);
let offset = 0;
let w = 10;
for(let x = 0; x < width; x += w){
for(let z = 0; z < height; z += w){
push();
let a = angle + offset;
let h = map(sin(a),-1,1,0,100);
translate(x - width / 2, 0, z -height / 2);
// ambientMaterial(255);
normalMaterial();
box(w-2, h , w - 2);
// rect(x - width / 2 + w / 2, 0, w - 2,h);
offset += 0.1;
pop();
}
}
angle += 0.1;
}