Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 23rd, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class CircleDraw {
  2.   float x, y, r, a;
  3.  
  4.   void drawSelf() {
  5.      fill(255);
  6.      noStroke();
  7.      ellipse(x + r * cos(a), y - r * sin (a), 5, 5);
  8.      a += 0.1;
  9.      
  10.      if (a >= 2 * PI) {
  11.        background(100);
  12.        a = 0;
  13.      }
  14.   }
  15. }
  16.  
  17. CircleDraw c;
  18.  
  19. void setup() {
  20.   size (400, 400);
  21.  
  22.   c = new CircleDraw();
  23.   c.x = width / 2;
  24.   c.y = height / 2;
  25.   c.r = 100;
  26.   c.a = 0;
  27. }
  28.  
  29. void draw() {
  30.   c.drawSelf();
  31. }