xxxxxxxxxx
34
n=5
function setup() {
createCanvas(600, 600,WEBGL);
angleMode(DEGREES)
}
function draw() {
background(0);
translate(-width/2,-width/2);
specularMaterial(250);
pointLight(105, 155, 225,200,200,200);
for(let i=0;i<=n;i++){
for(let j=0;j<=n;j++){
push()
translate(width/n*i,width/n*j,0)
dx=mouseX+width/2-width/n*i
dy=mouseY+width/2-width/n*i
rotateX(180-i*dx/50+360*sin(frameCount/5))
rotateY(90-j*dy/50+360*sin(frameCount/5))
rotateZ(90-j*dy/20+360*sin(frameCount/5))
box(width/n)
pop()
}
}
}
function mousePressed(){
if (n<60){
n=n+5
}
if (n>=60){
n=5
}
}