ICC
< back to sketch

int i,j;
int direction;

void setup(){

  size(300,300);
  direction =1;
}

void loop(){
  background(255,i,255-i);
  i=i+direction;


//  fill(0);
//  rect(i,100,30,30);

  fill(255,0,0);
  rect(270-i,i*2,30,30);

  if(i*2>300-30){
    //i=i-30;
    direction =-1;
  }
  if(i<0){
  //i=-30
  direction=5;
}
}

< back to sketch