Skip to content

Instantly share code, notes, and snippets.

@kuzemkon
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save kuzemkon/8e7aa39bca7a71074394 to your computer and use it in GitHub Desktop.

Select an option

Save kuzemkon/8e7aa39bca7a71074394 to your computer and use it in GitHub Desktop.
float x;
float a=150;
float b=150;
float da=1;
float db=2;
void setup() {
size(600,600,P3D);
}
void draw() {
x+=0.1;
a+=da;
b+=db;
if ((a > (width - 150)) || (a < 150)) da = - da;
if ((b > (height - 150)) || (b < 150)) db = - db;
background(50);
stroke(0);
fill(255);
translate(a,b);
rotateZ(x*PI/6);
pyramide();
}
void pyramide() {
beginShape();
vertex(0,0,0);
vertex(0,0,100);
vertex(100,0,100);
vertex(0,0,0);
vertex(0,100,100);
vertex(100,0,100);
vertex(-50,-50,100);
vertex(0,0,0);
vertex(0,100,100);
vertex(-50,-50,100);
vertex(0,0,0);
endShape();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment