Skip to content

Instantly share code, notes, and snippets.

@atduskgreg
Created November 15, 2011 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atduskgreg/1368012 to your computer and use it in GitHub Desktop.
Save atduskgreg/1368012 to your computer and use it in GitHub Desktop.
3d with inner rotation
float z;
float r = 0;
void setup()
{
size(500, 500, P3D);
z = 0;
}
void draw()
{
background(255);
translate(mouseX, mouseY);
pushMatrix();
r++;
rotateY(radians(r));
translate(-25, -25);
rect(-25, -25, 50, 50);
ellipse(0, 0, 50, 50);
rotateY(radians(90));
rect(0, 0, 50, 50);
popMatrix();
}
void mouseMoved() {
z = map(mouseX, 0, width, 0, 360);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment