Created
August 18, 2012 13:06
-
-
Save Todd-Davies/3386726 to your computer and use it in GitHub Desktop.
Processing progress wheel
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
//=============================================================================================== | |
//Author: Todd Davies | |
//Date: 18.08.2012 | |
//Description: I was bored, and needed to make sure I could still remember how to use Processing. | |
// Download Processing here: http://processing.org/download/ | |
//=============================================================================================== | |
int radius = 120; | |
int centerX = 250; | |
int centerY= 250; | |
int progress = 0; | |
int arcWeight = 3; | |
int circleWeight = 1; | |
color barColor = #0097D6; | |
color rimColor = #6BD3FF; | |
void setup() { | |
size(500,500); | |
smooth(); | |
noFill(); | |
stroke(0); | |
background(255); | |
} | |
void draw() { | |
background(255); | |
incrementProgress(); | |
drawEllipse(); | |
drawArc(); | |
//print("\n"+frameRate); | |
} | |
void drawEllipse() { | |
strokeWeight(circleWeight); | |
stroke(rimColor); | |
ellipse(centerX, centerY, radius ,radius); | |
} | |
void drawArc() { | |
float firstPoint = (float)(progress*(PI/180)); | |
float secondPoint = (float)(progress*(PI/180)) + PI/2; | |
strokeWeight(arcWeight); | |
stroke(barColor); | |
arc(centerX, centerY, radius, radius, firstPoint, secondPoint); | |
} | |
void incrementProgress() { | |
progress++; | |
if(progress==360) {progress=0;} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment