xxxxxxxxxx
54
/*
* @name Orbit Control
* @description Orbit control allows you to drag and move around the world.
*/
t = 0;
function setup() {
createCanvas(800, 800, WEBGL);
}
function draw() {
background(5);
w = 15;
// camera
orbitControl();
normalMaterial();
smooth();
//stroke(255);
//lighting
ambientLight(100);
pointLight(128, 128, 128, 100, 100, 30);
specularMaterial(250);
lightFalloff(1,0,0);
rotate(PI/6, createVector(-1,0.85,0));
translate(-50, 100, 0);
n = 25;
for (let i = 0; i <= n; i++) {
for (let j = 0; j <= n; j++) {
push();
amp = 28;
freq = 0.05;
wave = 0.02;
gap = 3;
offset = (i-n/2)*(i-n/2)+(j-n/2)*(j-n/2);
translate(
i*(w+gap),
-1*amp*sin(t*freq+offset*wave),
-1*j*(w+gap)
);
box(w, 400, w);
pop();
}
}
t += 1;
}