// configuration settings color faceColor = color(255, 255, 0); // white color irisColor = color(56, 183, 240); color mouthColor = color(243, 23, 56); // Draw a face centered at (x,y) having width w void drawFace(float x, float y, float w) { stroke(0); strokeWeight(1); // general face fill(faceColor); ellipse(x, y, w, w); // eyes float eyeWidth = 0.2*w; float eyeGap = 0.15*w; float eyeY = y - 0.15*w; fill(255); ellipse(x - eyeGap, eyeY, eyeWidth, eyeWidth); ellipse(x + eyeGap, eyeY, eyeWidth, eyeWidth); noStroke(); fill(irisColor); ellipse(x - eyeGap, eyeY, 0.6*eyeWidth, 0.6*eyeWidth); ellipse(x + eyeGap, eyeY, 0.6*eyeWidth, 0.6*eyeWidth); fill(0); ellipse(x - eyeGap, eyeY, 0.35*eyeWidth, 0.35*eyeWidth); ellipse(x + eyeGap, eyeY, 0.35*eyeWidth, 0.35*eyeWidth); // mouth noFill(); stroke(mouthColor); strokeWeight(0.05*w); arc(x, y, 0.6*w, 0.6*w, 0.25*PI, 0.75*PI); } // draw a message immediately below a previously drawn face void drawFaceMessage(String msg, float x, float y, float w) { textSize(12); float temp = textWidth(msg); textSize(12*w/temp); textAlign(CENTER, TOP); fill(0); text(msg, x, y + 0.5*w); }