//Sean McMannamy
//Tuesday September 8th
//Random, animated, if code.
//variable creation
int x1;
int y1;
int x2;
int y2;
int r=0;
int g=0;
int b=0;
int tran=0;
int count=0;
int weight=1;
//setup for animation
void setup () {
  size(500,500);
  background(255);
  smooth();
  //so that things may be seen
  frameRate(10);
}
//beginning of the drawing process
void draw(){
  //setting of the 4 major variables
  x1=int(random(width));
  y1=int(random(height));
  y2=int(random(height/4));
  x2=int(random(width/4));
  //dividing line between the rectangles and ellipses.
  stroke(0);
  line(0,0,width,height);
  //Creating the random thickness of lines.
  weight = (int)random(30);
  strokeWeight(weight);
  /*creation of rectangles below the divider line 
   in the situation of x1 being less than y1.*/
  if (x1<=y1) {
    stroke(g,b,r);
    fill(g,b,r,tran);
    strokeJoin(BEVEL);
    rect(x1,y1,x2,y2);
  }
  //creation of ellipses above divider line.
  else {
    stroke(r,g,b);
    fill(r,g,b,tran);
    ellipse(x1,y1,x2,y2);
  }
  //refreshing the backgorund every 10 seconds based on framerate.
  if(count>=100){
    background(r,g,b);
    count=0;
  }
  //color changes between each step.
  r+=15;
  g+=34;
  b-=20;
  tran+=30;
  //Reset for red pigment if exceeding allowable limits.
  if(r>=255) {
    r=0;
  }
  //Reset for green pigment if exceeding allowable limits.
  if(g>=255) {
    g=0;
  }
  //Reset for blue pigment if exceeding allowable limits.
  if(b<=0) {
    b=255;
  }
  //Reset for transparency if exceeding allowable limits.
  if(tran>255) {
    tran=0;
  }
  //increasing the count for the background reset.
  count+=1;
}

