Created
August 31, 2017 02:05
-
-
Save anonymous/4df275e91426eee3f824fe0cfbb7cafe to your computer and use it in GitHub Desktop.
Windows loading animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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