Skip to content

Instantly share code, notes, and snippets.

Created August 31, 2017 02:05
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 anonymous/4df275e91426eee3f824fe0cfbb7cafe to your computer and use it in GitHub Desktop.
Save anonymous/4df275e91426eee3f824fe0cfbb7cafe to your computer and use it in GitHub Desktop.
Windows loading animation
/**
* Code by Alexander Patlidanoski
* This function draws the windows logo in the middle of the screen
* and causes it to rotate on a central axis as though the Windows OS
* is loading.
*
* This function contains a Push/Pop matrix, that changes the positon of the
* starting X (across) and Y (down) axis to be in the centre of the screen.
*
* int rot and rot = rot + 1 causes the boxes to rotate 1 pixel every time
* the function is executed (which is infinate)
*/
// This is the command that draws the Windows logo
void draw() {
background(0);
windows();
// This creates the "loading" text
fill(255);
textSize(40);
text("Loading Windows 98", 200,520);
}
/**
* This is the code for the windows function
*/
int rot = 0;
// This is the code to draw the "windows" logo
void windows() {
// Rotates the Squares
pushMatrix();
translate(400, 300);
rotate(radians(rot));
// Red Square
stroke(255);
noStroke();
fill(255, 0, 0);
rect(-100, -100, 100, 100);
// Green Square
fill(0, 255, 0);
rect(10, -100, 100, 100);
//Blue Square
fill(0, 0, 255);
rect(-100, 10, 100, 100);
// Yellow Square
fill(255, 255, 0);
rect(10, 10, 100, 100);
popMatrix();
rot = rot + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment