void setup() {
size(400, 400);
background(88, 149, 18);
noLoop();
smooth();
}
void draw() {
face(0, 80, 80, 100);
face(35, 200, 80, 80);
face(70, 320, 80, 90);
face(105, 80, 200, 95);
face(140, 200, 200, 85);
face(175, 320, 200, 105);
face(200, 80, 320, 115);
face(225, 200, 320, 70);
face(250, 320, 320, 120);
saveFrame("excersize5.jpg");
}
void face(int gray, int x, int y, int s) {
stroke (gray);
strokeWeight(3);
//first row
fill(gray);
ellipse(x, y, s, s);//white circle
int fill2;
if(gray>127){
fill2=0;
}
else{
fill2=255;
}
float eyeSizeHt=random(10, 25);
float eyeSizeWth=random(8, 17);
//eyes
fill(fill2);
ellipse(x+16,y-15, eyeSizeWth,eyeSizeHt );//left eye
ellipse(x-16, y-15, eyeSizeWth, eyeSizeHt);
//nose
stroke(fill2);
line(x, y-8, x+7, y+8);
line(x+7, y+8, x-1, y+4);
float mouthSizeHt=random(10, 25);
float mouthSizeWth=random(25, 40);
//mouth
ellipse(x, y+25, mouthSizeWth, mouthSizeHt);//left nose
}
Exercise 05: Create a function that draws a face. Use two parameters to change the shape and features of the face. Using your function, draw 9 faces in the display window in a regular 3x3 matrix. Use different parameters for each face drawn to give each a unique shape