2012年12月7日 星期五

B10034025_鍾宜芳_聖誕樹




void setup(){
size(300, 300);
background(0);
}

void draw(){
 
  //middle trunk
  fill(200, 145, 50);
  noStroke();
  rect(140, 220, 20, 50);
  //side trunks
  fill(80, 50, 0);
  noStroke();
  rect(60, 195, 16, 50);
  rect(224, 195, 16, 50);
 
  //middle leaves
  for(int a = 0; a<=160; a=a+20){
    stroke(255);
    line(150, a+20, 105, a+70);
    line(150, a+20, 195, a+70);
  }
  //left leaves
   for(int a = 0; a<=160; a=a+15){
    stroke(125);
    line(68, a+10, 36, a+46);
    line(68, a+10, 100, a+46);
  }
  //right leaves
   for(int a = 0; a<=160; a=a+15){
    stroke(125);
    line(232, a+10, 200, a+46);
    line(232, a+10, 264, a+46);
  }  
 
  drawBells();
}

//darw bells
void drawBells(){
  //left
  for(int a = 45; a<=225; a=a+40){
  fill(255, 0, 0);
  noStroke();
  ellipse(127, a, 8, 8);
  }
  //right
  for(int a = 70; a<=200; a=a+40){
  fill(255, 125, 0);
  noStroke();
  ellipse(177, a, 8, 8);
  }
}

沒有留言:

張貼留言