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

Lab2 : forest


 void setup(){
 size(400, 200);
 background(64,64,64);

 //friend's tree
draw_rect(130,100,50,150) ;
draw_circle(150,90,30); // circle
draw_circle(125,110,30); // circle
draw_circle(100,100,30); // circle
draw_circle(75,90,30); // circle
draw_circle(100,80,30); // circle
draw_circle(125,70,30); // circle
draw_circle(150,60,30); // circle
draw_circle(175,70,30); // circle
draw_circle(200,80,30); // circle
draw_circle(225,90,30); // circle
draw_circle(200,100,30); // circle
draw_circle(175,110,30); // circle
}
 void draw_rect (int x, int y , int small , int longg) {
 fill(#8B4513);
 noStroke();
 rect(x+80,y,small,longg);
}
void draw_circle (int x,int y , int radius){
fill(#00FF00);
noStroke();
ellipse(x+80,y,2*radius,2*radius);

 //my tree =="
fill(#8A5C00);
draw_tree(105, 80, 165, 80, 165, 163, 105, 163); //brown tree
fill(#19A319);
noStroke();
draw_leaves(100, 90, 40, 40); //green leaves1
draw_leaves(85, 65, 40, 40); //green leaves2
draw_leaves(105, 50, 40, 40); //green leaves3
draw_leaves(153, 45, 30, 40); //green leaves4
draw_leaves(185, 75, 40, 40); //green leaves5
draw_leaves(175, 60, 40, 40); //green leaves6
draw_leaves(175, 90, 30, 40); //green leaves7
draw_leaves(140, 63, 90, 65); //green leaves8
}
void draw_tree(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4){
quad(x1,y1+50, x2, y2+50, x3, y3+50, x4, y4+50);
}
void draw_leaves(int x,int y,int width,int height){
ellipse(x, y+50, width, height); }

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

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