P2:Variable Faces – Erin Fuller

//Erin Fuller
//SectionA
//efuller@andrew.cmu.edu
//Project-02

// Simple beginning template for variable face.
var eyeSize = 40;
var faceWidth = 150;
var faceHeight = 150;
var skin = 80
var back = 150


function setup() {
    createCanvas(480, 640);
}

function draw() {
    colorMode(HSB);
    var c = color(back, 26, 79);
    background(c); 

    //face
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    var b = color(26.09, 52, skin);
    fill(b);



    //eye  placement
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    
    // eye size
    fill(0, 100, 0)  
    ellipse(eyeLX, height/2, eyeSize, eyeSize);
    ellipse(eyeRX, height/2, eyeSize, eyeSize); 
    colorMode(HSB);
    fill(0, 100, 0)
    var b = color(26.09, 52, skin);
    fill(b);
}


function mousePressed() {
    // when the user clicks, these variables are reassigned
    // to random values within specified ranges. For example,
    // 'faceWidth' gets a random value between 75 and 150.
    faceWidth = random(250, 350);
    faceHeight = random(300, 370);
    eyeSize = random(30, 60);
    skin = random(45, 100); //changes brightness value of skin to imitate skin tones
    back = random (0, 360); //changes background colors
}

I think this project was harder than the one from the previous week. But I think the way I used HSB colors rather than RGB was a good way to create more realistic skin tone variation.

Leave a Reply