xxxxxxxxxx
28
box_size = 20
rez = 0.003
amount = 400
speed = 0.005
factor = 0.008
function setup() {
createCanvas(400, 400, WEBGL);
camera(2, 230, (height/1.5) / tan(PI/6), 1, 30, 4, 25, 1, 0);
}
function draw() {
background(220);
ambientLight(50);
directionalLight(35, 0, 255, 0.25, 0.25, 0);
pointLight(0, 0, 255, -width/2 +100, -height/2 + 100, 250); //locX, locY, 250);
for (x=-width; x<=width; x+=box_size-10) {
for (y=-height; y<=height; y+=box_size-10) {
push()
translate(x,y,0)
depth = constrain(noise(x * factor + frameCount * speed, y * factor + frameCount * speed)*amount,0, 10500)
//console.log(depth)
box(box_size,box_size,depth)
pop()
}
}
}