Haig Armen Educational Archive


Exercise 11

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

using random in a different way…


float slow_circle_x = 0;
float fast_circle_x = 0;

void setup() {
  size(400,400); 
  noStroke();
}

void draw() {
  background(#1BB1F5);
  
  float slow_circle_size = 50;
  
// what do you think this next line does?
  if(random(10) > 9) {
    slow_circle_size = 60;
  }
  
  fill(#C1FF3E);
  ellipse(slow_circle_x,50, slow_circle_size, slow_circle_size);
  slow_circle_x = slow_circle_x + 1;

  fill(#FF4800);
  ellipse(fast_circle_x,50, 50, 50);
  fast_circle_x = fast_circle_x + 5;

  
  if(slow_circle_x > 400) {
    slow_circle_x = 0;
  }
  if(fast_circle_x > 400) {
    fast_circle_x = 0;
  }
}

No comments on ‘Exercise 11’

Leave a Reply