//weird thing float[] xPos = new float[10]; float[] yPos = new float[10]; //float[] zPos = new float[10]; float[] xSpeed = new float[100]; float[] ySpeed = new float[100]; color rndColor; void setup(){ size (400,400, P3D); for(int i=0; i<10; i=i+1){ xPos[i]=random(400); yPos[i]=random(400); ySpeed[i]=random(2); xSpeed[i]=random(2); background(255); noStroke(); noCursor(); } } void draw(){ //left wall pushMatrix(); fill(100,10); //100,15 to show color sections rect(0,0,width, height); //translate(200,200,-100); rotateY(45); //rotateX(45); for(int i=0; i<10; i=i+1){ float r = 10; rect (xPos[i],yPos[i],20+r,i-r); rndColor = color(0, random(255),0); fill(rndColor); xPos[i]=xPos[i]+xSpeed[i]; //box (mouseX,mouseY,10); xPos[i]=mouseX + random(50)-25; yPos[i]=mouseY + random(50)-25; if(xPos[i]<0 || xPos[i]>400){ xSpeed[i]=xSpeed[i]*-1; } if(yPos[i]<0 || yPos[i]>400){ ySpeed[i]=ySpeed[i]*-1; } } popMatrix(); //right wall pushMatrix(); translate(width/2,0,-400); rotateY(-45); for(int i=0; i<10; i=i+1){ float r = 10; rect (xPos[i],yPos[i],20+r,i-r); rndColor = color(100, random(255),0); fill(rndColor); xPos[i]=xPos[i]+xSpeed[i]; xPos[i]=xPos[i]+xSpeed[i]; yPos[i]=yPos[i]+ySpeed[i]; if(xPos[i]<0 || xPos[i]>400){ xSpeed[i]=xSpeed[i]*-1; } if(yPos[i]<0 || yPos[i]>400){ ySpeed[i]=ySpeed[i]*-1; } } popMatrix(); //small right pushMatrix(); translate(width/2,100,-200); scale(.5); rotateY(-45); for(int i=0; i<10; i=i+1){ float r = 10; rect (xPos[i],yPos[i],20+r,i-r); rndColor = color(100, 0,random(255)); fill(rndColor); xPos[i]=xPos[i]+xSpeed[i]; xPos[i]=xPos[i]+xSpeed[i]; yPos[i]=yPos[i]+ySpeed[i]; if(xPos[i]<0 || xPos[i]>400){ xSpeed[i]=xSpeed[i]*-1; } if(yPos[i]<0 || yPos[i]>400){ ySpeed[i]=ySpeed[i]*-1; } } popMatrix(); //small left pushMatrix(); translate(width/2,100,-200); scale(.5); rotateY(-40); for(int i=0; i<10; i=i+1){ float r = 10; rect (xPos[i],yPos[i],20+r,i-r); rndColor = color(50, 0,random(255)); fill(rndColor); xPos[i]=xPos[i]+xSpeed[i]; xPos[i]=xPos[i]+xSpeed[i]; yPos[i]=yPos[i]+ySpeed[i]; if(xPos[i]<0 || xPos[i]>400){ xSpeed[i]=xSpeed[i]*-1; } if(yPos[i]<0 || yPos[i]>400){ ySpeed[i]=ySpeed[i]*-1; } } popMatrix(); //centered right pushMatrix(); translate(width/2,150,-100); scale(.3); rotateY(-40); for(int i=0; i<10; i=i+1){ float r = 10; rect (xPos[i],yPos[i],20+r,i-r); rndColor = color(50, random(255),0); fill(rndColor); xPos[i]=xPos[i]+xSpeed[i]; xPos[i]=xPos[i]+xSpeed[i]; yPos[i]=yPos[i]+ySpeed[i]; if(xPos[i]<0 || xPos[i]>400){ xSpeed[i]=xSpeed[i]*-1; } if(yPos[i]<0 || yPos[i]>400){ ySpeed[i]=ySpeed[i]*-1; } } popMatrix(); //centered left pushMatrix(); translate(width/2,150,-100); scale(.3); rotateY(-45); for(int i=0; i<10; i=i+1){ float r = 10; rect (xPos[i],yPos[i],20+r,i-r); rndColor = color(50, random(255),0); fill(rndColor); xPos[i]=xPos[i]+xSpeed[i]; xPos[i]=xPos[i]+xSpeed[i]; yPos[i]=yPos[i]+ySpeed[i]; if(xPos[i]<0 || xPos[i]>400){ xSpeed[i]=xSpeed[i]*-1; } if(yPos[i]<0 || yPos[i]>400){ ySpeed[i]=ySpeed[i]*-1; } } popMatrix(); //ceiling pushMatrix(); translate(0,0,-400); rotateX(90); for(int i=0; i<10; i=i+1){ float r = 10; rect (xPos[i],yPos[i],20+r,i-r); rndColor = color(0, random(255),100); fill(rndColor); xPos[i]=xPos[i]+xSpeed[i]; xPos[i]=xPos[i]+xSpeed[i]; yPos[i]=yPos[i]+ySpeed[i]; if(xPos[i]<0 || xPos[i]>400){ xSpeed[i]=xSpeed[i]*-1; } if(yPos[i]<0 || yPos[i]>400){ ySpeed[i]=ySpeed[i]*-1; } } popMatrix(); //floor pushMatrix(); translate(0,500,100); rotateX(-90); for(int i=0; i<10; i=i+1){ float r = 10; rect (xPos[i],yPos[i],20+r,i-r); rndColor = color(0, random(255),100); fill(rndColor); xPos[i]=xPos[i]+xSpeed[i]; xPos[i]=xPos[i]+xSpeed[i]; yPos[i]=yPos[i]+ySpeed[i]; if(xPos[i]<0 || xPos[i]>400){ xSpeed[i]=xSpeed[i]*-1; } if(yPos[i]<0 || yPos[i]>400){ ySpeed[i]=ySpeed[i]*-1; } } popMatrix(); }