Haig Armen Educational Archive


Exercise 33

by Haig. Average Reading Time: less than a minute.

Now let’s animate the circles to move independently.


int _num = 10;
Circle[] _circleArr = {
};
void setup() {
  size(800, 800);
  background(255);
  smooth();
  strokeWeight(1);
  fill(150, 50);
  drawCircles();
}
void draw() {
  background(255);
  for (int i=0; i<_circleArr.length; i++) {
    Circle thisCirc = _circleArr[i];
    thisCirc.updateMe();
  }
}
void mouseReleased() {
  drawCircles();
}
void drawCircles() {
  for (int i=0; i (width+radius)) { 
      x = 0 - radius;
    }
    if (x  (height+radius)) { 
      y = 0 - radius;
    }
    if (y < (0-radius)) { 
      y = height+radius;
    }
    drawMe();
  }
}

No comments on ‘Exercise 33’

Leave a Reply