Saturday, 30 August 2014

Animation Hope lab 2

float col= 255;
float changepositonx = 300, changepositony = 0, changep2 = -100;
void setup() {
  size(323, 200);
  background(11, 222, 111);
}

void draw(){
  background(11, 222, 111);
  draw_car(changepositony);
  draw_car(changep2);
}
void draw_car(float changepositony){
  draw_colour();
  changepositonx = changepositonx - 1;
  if(changepositonx < -180){changepositonx = 300 ;}
rect(changepositonx+60, changepositony+135, 170, 40);
rect(changepositonx+100, changepositony+105, 100, 30);
fill(1, 1, 1);
ellipse(changepositonx+100, changepositony+170, 35, 35);
ellipse(changepositonx+190, changepositony+170, 35, 35);
fill(200);
ellipse(changepositonx+100, changepositony+170, 30, 30);
ellipse(changepositonx+190, changepositony+170, 30, 30);
rect(changepositonx+110, changepositony+110, 35, 20);
rect(changepositonx+155, changepositony+110, 35, 20);
fill(1, 1, 1);
ellipse(changepositonx+100, changepositony+170, 20, 20);
ellipse(changepositonx+190, changepositony+170, 20, 20);
fill(255);
ellipse(changepositonx+70, changepositony+150, 15, 10);
}
void draw_colour(){
 col = col - 0.5;
if(col == 40){col = 255;}
fill(col, 184, 222);
}


No comments:

Post a Comment