Skip to content

Instantly share code, notes, and snippets.

@Todd-Davies
Created August 18, 2012 13:06
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 Todd-Davies/3386726 to your computer and use it in GitHub Desktop.
Save Todd-Davies/3386726 to your computer and use it in GitHub Desktop.
Processing progress wheel
//===============================================================================================
//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