Skip to content

Instantly share code, notes, and snippets.

@eamonnbell
Created September 26, 2015 19:47
Show Gist options
  • Save eamonnbell/efbfb14266743d0b498c to your computer and use it in GitHub Desktop.
Save eamonnbell/efbfb14266743d0b498c to your computer and use it in GitHub Desktop.
boxes in 3D space - Janky first go at Processing.org
int n = 12;
void setup()
{
noStroke();
size(600, 600, P3D);
frameRate(24);
}
void draw()
{
background(0);
lights();
pushMatrix();
float x = 0;
float y = 0;
if (mousePressed){
x = (mouseY - height/2) * 0.01;
y = (mouseX - width/2) * 0.01;
rotateX(x);
rotateY(y);
}
rotateX(x);
rotateY(y);
for (int i = 0; i<n; i++) {
for (int j = 0; j<n; j++) {
pushMatrix();
translate(height/2 + (25 * i), width/2, (25 * j));
fill(noise(i + j + frameCount)*255);
box(20,noise(i + j + frameCount)*height*.4,20 );
popMatrix();
}
}
popMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment