วันเสาร์ที่ 30 สิงหาคม พ.ศ. 2557

Football Field In Function.


float distant = 20;

void setup () {
  size (500, 250);
}

void draw () {
  background (0, 255, 0);
  footballfield_soom (distant);
  distant = distant + 0.1;
  if (distant >= height-220){
  distant = 20;
  }
}

void footballfield_soom (float distant) {
  background (0, 255, 0);
  noFill();
  stroke (255);
  strokeWeight (3);
  rect (distant+10, distant-10, width-((distant+10)*2), height-((distant-10)*2));

  rect (distant, (height/2)-15, distant-10, distant+10);
  rect (width-(distant+10), (height/2)-15, distant-10, distant+10);

  rect (distant+10, (height/2)-60, (distant*3)-10, distant*6);
  rect (width-(distant*4), (height/2)-60, (distant*3)-10, distant*6);

  line (width/2, distant-10, width/2, height-(distant-10));
  ellipse (width/2, height/2, distant*3, distant*3);
  ellipse (width/2, height/2, 5, 5);

  arc (distant*4, height/2, distant*3, distant*3, (PI*3)/2, (PI*5)/2);
  ellipse (distant*4, height/2, 5, 5);
  arc (width-(distant*4), height/2, distant*3, distant*3, HALF_PI, (PI*3)/2);
  ellipse (width-(distant*4), height/2, 5, 5);

  strokeWeight (2);
  rect (distant+10, (height/2)-30, distant+10, distant*3);
  rect (width-(distant*3), (height/2)-30, distant+10, distant*3);
}

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

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