Created
October 10, 2011 17:18
-
-
Save raheelahmad/1275840 to your computer and use it in GitHub Desktop.
Circle Drawer
This file contains hidden or 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
class CircleDraw { | |
float x, y, r, a; | |
void drawSelf() { | |
fill(255); | |
noStroke(); | |
ellipse(x + r * cos(a), y - r * sin (a), 5, 5); | |
a += 0.1; | |
if (a >= 2 * PI) { | |
background(100); | |
a = 0; | |
} | |
} | |
} | |
CircleDraw c; | |
void setup() { | |
size (400, 400); | |
c = new CircleDraw(); | |
c.x = width / 2; | |
c.y = height / 2; | |
c.r = 100; | |
c.a = 0; | |
} | |
void draw() { | |
c.drawSelf(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment