xxxxxxxxxx
/*boxes_recurrents
*jacques maire le 13/07/2022
*/
let tempo=0;
let sc;
let niv;
function setup() {
createCanvas(windowWidth,windowHeight,WEBGL);
tempo=0;sc=0.95;
specularMaterial(250);niv=0;
colorMode(RGB,255);
}
function draw() {
background(0,0,80);
tempo=millis()*0.0001;
ambientLight(0,0,60);
translate(-100,0,-2000);
orbitControl();
recc(2000,2000,100,0.9999,0);
}
function recc(x,y,z,tmp,niv){
fill(0,niv*55/60,niv*120/60);
let axe=createVector(1,1,1);
noStroke();
rotate(cos(tmp),axe);
translate(x*0.1,y*0.1,z*0.1);
specularMaterial(150);
pointLight(65,60, 70, 3000, -3000, -1650);
box(x,y,z);
translate(x*0.01,y*0.01,z*0.01);
niv=niv+1; rotateZ(tempo);
if(niv<=160){
recc(sc*x,sc*y,sc*z,tmp,niv);}
}