วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558

Lab 3 battery

int space = 5;
int space2 = 5;
int posY=2;
void setup() {
  size(500, 500);
}
void draw() {
  background(0, 0, 0);
  fill(225, 225, 225);
  strokeWeight(5);
  stroke(255, 255, 255);
  rect(150, 80, 200, 380);
  rect(190, 20, 40, 60);
  rect(270, 20, 40, 60);
  fill(0, 255, 0);
  rect(152, 85, 195, 370);
  fill(0, 0, 0);
  rect(152, 85, 195, 4+space);
  space = (space + 1 )%width;
  if ( space>=368) {
    space = (space - 1)%width;
    fill(0, 225, 0);
    stroke(255, 255, 255);
    rect(152, 455-posY, 195, 2+space2);
    if (space2<370) {
      space2=(space2 +1)%width;
      posY=(posY+1)%width;
    }
  }
}


ไม่มีความคิดเห็น:

แสดงความคิดเห็น