Project 02- Variable Face

sillymir proj2Download

var bg1=255
var bg2=98
var bg3=109
var hairlength=200
var teethwidth=50
var teethHeight=50
var lipsWidth= 90
var lipsHeight= 90
var eyeGreen= 77
var hc1=215 // hair color
var hc2= 200
var hc3= 174

function setup() {
    createCanvas(480, 640);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
    background(204);
    fill (bg1, bg2, bg3); // red dark
    rect (0, 0, 480, 640)
    fill (238, 208, 191) ; // skin base color
    circle (240, 240, 240);
    fill (181, 82, 94); // lips
    arc (240, 300, lipsWidth, lipsHeight, 245, 600)
    fill (255, 254, 246); // teeth
    arc (240, 307, teethwidth, teethHeight, 245, 600)
    fill (228, 141, 146) ; // cheek left
    circle (175, 280, 28);
    fill (228, 141, 146) ; // cheek right
    circle (305, 280, 28);
    fill (223, 190, 170) ; // nose left
    circle (230, 278, 10);
    fill (223, 190, 170) ; // nose right
    circle (250, 278, 10);
    fill (223, 190, 170) ; // nose center
    circle (240, 280, 20);
    fill (235, 258, 234); // eye white left
    circle (200, 235, 35)  
    fill (235, 258, 234); // eye white right
    circle (280, 235, 35)
    fill (74, eyeGreen, 68); // eye color left
    circle (200, 235, 25)
    fill (74, eyeGreen, 68); // eye color right
    circle (280, 235, 25)
    fill (28, 22, 26); // eye pupil left
    circle (200, 235, 12)
    fill (28, 22, 26); // eye pupil right
    circle (280, 235, 12); 
    fill (251, 255, 248); // eye hl left
    circle (205, 230, 5) 
    fill (251, 255, 248); // eye hlright
    circle (285, 230, 5);
    fill (154, 114, 71); // eyebrow left thick
    rect (165, 205, 50, 5)
    fill (154, 114, 71); // eyebrow right thick
    rect (260, 205, 50, 5)
    fill (hc1, hc2, hc3); // hair left side
    rect (100, 180, 60, hairlength)
    fill (hc1, hc2, hc3); // hair right side
    rect (320, 180, 60, hairlength);
    fill (hc1, hc2, hc3); // hair across
    arc (240, 200, 280, 190, 531, 710);

}

function mousePressed() {
    bg1 = random(1, 254);
    bg2 = random(1, 254);
    bg3 = random(1, 254);
    hairlength = random(200,400);
    teethwidth= random(40,60);
    teethHeight= random(40,60);
    lipsWidth= random(80,100);
    lipsHeight= random(80,100);
    eyeGreen= random (30,150);
    hc1= random (1,254);
    hc2= random (1,254);
    hc3= random (1,254);    


}

I wanted to see variations in color. I changed the eyes and background colors. I also altered hair length and mouth size.

Leave a Reply