Project 2: Generative Faces

How I feel after having to eat Resnik because I left my lunch at home.

sketch
var eyeSizeL = 20;
var eyeSizeR = 20;
var faceWidth = 100;
var faceHeight = 150;
var chinHeight = 300;
var irisSizeL = 10;
var irisSizeR = 10;
var browHeightL = 130
var browHeightR = 130
var cheekSizeL = 70
var cheekSizeR = 70
var lusciousLips = 15
var juicyLips = 17
var thickLipsTop = 13
var thickLipsBottom = 22

let moodColor = 50
 
function setup() {
    createCanvas(300, 500);
}
 
function draw() {
    background(moodColor);
    noStroke ();
    fill ('#86BB43');
    ellipse(width /2, height / 3, 135,140); //head shape
    fill('#F2BE80');
    rect(width/2 -15,250,30,60); //neck
    fill('#E856AD');
    ellipse(width/2, height,210,360,); 
    rect(width/2 -20, 300, 40,60)//shirt
    rect(width/2 -25, 280, 50,25, 10)
    fill('#86BB43');
    ellipse(width /2, 230, 80); //chin
    fill('#86BB43');
    circle(width/2-40, height/7*3,cheekSizeL); //left cheek
    circle(width/2+40, height/7*3, cheekSizeR); //right cheek
    fill (150);
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    fill('#2B3D15');
    ellipse(eyeLX, browHeightL,30,20); //eyebrow
    ellipse(eyeRX, browHeightR-3,30,20); //eyebrow
    fill('#86BB43');
    ellipse(eyeLX, browHeightL-6, 35, 20); //eyebrow
    ellipse(eyeRX, browHeightR+3, 35, 20); //eyebrow
    fill(225)
    circle(eyeLX, height / 3, eyeSizeL); //eyeball
    circle(eyeRX, height / 3, eyeSizeR); //eyeball
    fill(10);
    ellipse(eyeLX, height / 3, irisSizeL, irisSizeL); //pupil
    ellipse(eyeRX, height / 3, irisSizeR, irisSizeR); //pupil
    fill('#D25A27');
    arc(width/2-5, 222, thickLipsTop,lusciousLips, PI,TWO_PI) //top lip
    arc(width/2+5, 222, thickLipsTop,lusciousLips, PI, TWO_PI) //top lip
    arc(width/2, 224,thickLipsBottom,juicyLips, 0,PI) //bottom lip
  
    
    
    
}
 
function mousePressed() {
    faceHeight = random(100, 200);
    eyeSizeL = random(15, 35);
    eyeSizeR = random(15, 35);
    irisSizeL = random(7,15);
    irisSizeR = random(7,15);
    browHeightL = random(125,135);
    browHeightR = random(125,135);
    cheekSizeL = random(70, 90);
    cheekSizeR = random(70, 90);
    lusciousLips = random(13, 25);
    juicyLips = random(15,25)
    thickLipsTop = random(13, 20)
    thickLipsBottom = random(20, 30)
  
    moodColor = color(random(30), random(95), random(40))
}

Leave a Reply