Skip to content

Instantly share code, notes, and snippets.

@becojo
Created June 16, 2013 16:21
Show Gist options
  • Save becojo/5792529 to your computer and use it in GitHub Desktop.
Save becojo/5792529 to your computer and use it in GitHub Desktop.
Interactive Fez 2 Logo
PVector[] stars;
int startsCount = 700;
float z = 0;
void setup()
{
int i;
size(800, 450, P3D);
noFill();
stars = new PVector[startsCount];
for(i = 0; i < startsCount; i++)
{
stars[i] = new PVector(random(-20, 20), random(-20, 20), random(-10, 10));
}
}
void draw()
{
int i;
background(0xff141623);
translate(width / 2, height / 2, map(mouseY, 0, height, 0, 200));
rotateY(map(mouseX, 0, width, -QUARTER_PI, QUARTER_PI));
scale(40, 40, 160);
translate(-3, 0, 0);
stroke(255, 80);
strokeWeight(3);
for(i = 0; i < startsCount; i++)
{
point(stars[i].x, stars[i].y, stars[i].z);
}
stroke(0xff72cbe0);
fez();
translate(0, 0, -0.01);
stroke(0xffdf2d32);
bar();
translate(-6, 0, 0);
bar();
}
void bar()
{
beginShape();
vertex(0, -2, 0);
vertex(0, -2, -1);
vertex(0, 2, -1);
vertex(0, 2, 0);
vertex(0, -2, 0);
endShape();
}
void fez()
{
beginShape();
vertex(1, -1, 0);
vertex(-1, -1, 0);
vertex(-1, 1, 0);
vertex(-1, 1, -1);
vertex(-1, -1, -1);
vertex(1, -1, -1);
vertex(1, -1, 0);
endShape();
line(-1, -1, -1, -1, -1, 0);
line(-1, 0, 0, 1, 0, 0);
translate(3, 0, 0);
beginShape();
vertex(1, -1, 0);
vertex(-1, -1, 0);
vertex(-1, 1, 0);
vertex(1, 1, 0);
vertex(1, 1, -1);
vertex(-1, 1, -1);
vertex(-1, -1, -1);
vertex(1, -1, -1);
vertex(1, -1, 0);
endShape();
line(-1, -1, 0, -1, -1, -1);
line(-1, 1, 0, -1, 1, -1);
line(-1, 0, 0, 0, 0, 0);
translate(3, 0, 0);
beginShape();
vertex(1, -1, 0);
vertex(1, -1, -1);
vertex(-1, -1, -1);
vertex(-1, -1, 0);
vertex(1, -1, 0);
vertex(-1, 1, 0);
vertex(-1, 1, -1);
vertex(1, 1, -1);
vertex(1, 1, 0);
vertex(-1, 1, 0);
endShape();
line(-1, 1, -1, 1, -1, -1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment