/* PCS - complete the person and house -- look for "TO DO" - ZJW Wood*/ boolean hat = true; void draw() { background(50, 50, 200); /*TO DO finish this house with a triangle roof and door */ fill(250, 150, 50); rect(0, 500, 200, 300); //add the triangle roof fill(150, 250, 250); //TO DO add the door - be sure to pick a fill color /*TO DO ADD the sun using an ellipse */ /*TO DO finish drawing a person */ line(260, 620, 260, 640); drawFace(260, 600, 50, 0, hat); fill(50, 90, 50); //body rect(230, 640, 60, 70); //example arm and hand line(230, 640, 210, 680); line(210, 680, 230, 700); fill(128); ellipse(225, 700, 15, 10); //example leg line(240, 710, 230, 795); ellipse(225, 795, 30, 10); /*TO DO figure out how to draw lots of flowers */ drawFlower(500, 750); } /* this is an example of a for loop for (int i=0; i < 5; i ++) { drawFlower(random(500, 700), 750); } */ void setup() { size(800, 800); } void drawFlower(float center_x, float center_y) { float r, cx, cy; r = 10; fill(255, 255, 200); ellipse(center_x, center_y, 10, 10); fill(240, 20, 160); for (int t=0; t<360; t+=60) { cx =r*cos(radians(t)); cy = r*sin(radians(t)); ellipse(center_x+cx, center_y+cy, 10, 10); } stroke(0, 190, 0); line(center_x, center_y+r, center_x, center_y +5*r); stroke(0); } void drawFace(float fCx, float fCy, float fW, float rot, boolean hat) { //ratio face - sept. 2015 - ZJ Wood float faceH, faceW; float eyeH, eyeW; float noseH; pushMatrix(); translate(fCx, fCy); rotate(radians(rot)); translate(-fCx, -fCy); faceW = 0.7*fW; faceH = 1.6*faceW; noseH = faceH/4; eyeW = .2*faceW; eyeH = eyeW/1.6; if (!hat) { //hair in back of head fill(#6F5130); ellipse(fCx, fCy, faceW*1.5, faceH*1.2); } strokeWeight(2); //fill(180, 137, 138); fill(192, 110, 71); //ears ellipse(fCx-faceW/2, fCy+noseH/2, eyeW*.5, noseH); ellipse(fCx+faceW/2, fCy+noseH/2, eyeW*.5, noseH); //head ellipse(fCx, fCy, faceW, faceH); //eyes fill(255); ellipse(fCx-eyeW, fCy, eyeW, eyeH); ellipse(fCx+eyeW, fCy, eyeW, eyeH); //eyebrows fill(83, 49, 32); arc(fCx-eyeW, fCy-eyeH, eyeW*1.4, eyeH, PI, TWO_PI); arc(fCx+eyeW, fCy- eyeH, eyeW*1.4, eyeH, PI, TWO_PI); //iris fill(122, 76, 23); ellipse(fCx-eyeW, fCy, eyeH, eyeH); ellipse(fCx+eyeW, fCy, eyeH, eyeH); //pupils fill(23); ellipse(fCx-eyeW, fCy, eyeH/2, eyeH/2); ellipse(fCx+eyeW, fCy, eyeH/2, eyeH/2); //nose //fill(101, 67, 67); fill(174, 99, 69); arc(fCx, fCy+noseH, eyeW, eyeH, 0, PI); line(fCx, fCy, fCx-eyeW/2, fCy+noseH); //lips //fill(117, 83, 83); fill(201, 90, 75); arc(fCx, fCy+1.5*noseH, 2*eyeW, eyeH, 0, PI); //bangs if (hat) { fill(0); ellipse(fCx, fCy-noseH, faceW*1.5, eyeH); arc(fCx, fCy-noseH, faceW, faceH/2, PI, TWO_PI); } else { fill(#6F5130); noStroke(); arc(fCx, fCy-noseH, faceW, faceH/1.5, PI, TWO_PI); stroke(0); } popMatrix(); }