Project-02-Variable-Face Section D

I created an alien-like girl! I enjoyed the creativity of the process and clicking my mouse to generate well-proportioned ones with a nice color pallet.

sketch- generative artDownload
// Sandy Youssef
// Section D
var eyeSizeW = 10;
var eyeSizeH = 10;
var pupilSize = 10
var faceWidth = 100;
var faceHeight = 120;
var skinR = 255
var skinG = 178
var skinB = 102


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

function draw() {
    background(180);
    noStroke();
    // hair
    fill(skinR - 70, skinG - 70, skinB - 70);
    ellipse(width/2, height/2, 200, 250); 
    // bow
    fill(255);
    ellipse(width/2, height*0.30, 40, 40); 
    triangle(180, 155, 180, 230, 240, 196); 
    triangle(300, 155, 300, 230, 230, 196);
    fill(skinR - 50, skinG - 50, skinB - 50);
    // ears
    fill(255);
    ellipse(width* 0.38, height/2, 30, 40); 
    ellipse(width* 0.62, height/2, 30, 40);
    // neck
    fill(skinR - 40, skinG - 40, skinB - 40);
    rect(width* 0.45, height/2, 45, 90); 
    // face
    fill(skinR, skinG, skinB);
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);  
    // shirt
    fill(255);
    ellipse(width/2, height* 0.75, 150, 150) 
    // eyes
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    fill(255);
    ellipse(eyeLX, height / 2, eyeSizeW, eyeSizeH);
    fill(255);
    ellipse(eyeRX, height / 2, eyeSizeW, eyeSizeH);
    fill(0);
    var pupilL = width/2 - faceWidth * 0.25;
    var pupilR = width/2 + faceWidth * 0.25;
    fill(skinR - 50, skinG - 50, skinB - 50);
    ellipse(pupilL, height/2, pupilSize, pupilSize); // left pupil
    ellipse(pupilR, height/2, pupilSize, pupilSize); // right pupil
    // nose
    var nose1 = width/2 - faceHeight* 0.05;
    var nose2 = width/2 + faceHeight * 0.05;
    var nose3 = width/2 - faceWidth * 0.005;
    fill(skinR - 40, skinG - 40, skinB - 40);
    triangle(nose1, height*0.55, nose2, height*0.55, nose3, height*0.5)
    // mouth
    fill(238, 131, 163); 
    arc(width/2, height* 0.57, 40, 23, radians(0), radians(180));  // lips
    fill(255);
    arc(width/2, height* 0.574, 30, 15, radians(0), radians(180)); // teeth
}


function mousePressed() {
    // when the user clicks, these variables are reassigned
    // to random values within specified ranges.
    faceWidth = random(90, 180);
    faceHeight = random(130, 180);
    eyeSizeW = random(10,35);
    eyeSizeH = random (10,30);
    pupilSize = random(8, 12);
    skinR = random(70,230);
    skinG = random (70,230);
    skinB = random (70,230);
    mouth = random (1,3);
}

Leave a Reply