xxxxxxxxxx
28
box_size = 20
rez = 0.003
amount = 400
speed = 0.005
factor = 0.008
function setup() {
createCanvas(400, 400, WEBGL);
camera(0, 200, (height/2) / tan(PI/6), 0, 0, 0, 0, 1, 0);
}
function draw() {
background(220);
ambientLight(100);
directionalLight(255, 0, 0, 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) {
for (y=-height; y<=height; y+=box_size) {
push()
translate(x,y,0)
depth = constrain(noise(x * factor + frameCount * speed, y * factor + frameCount * speed)*amount,0, 1000)
//console.log(depth)
box(box_size,box_size,depth)
pop()
}
}
}