Project-02-Variable Face

sketch

var eyeSize = 20;
var faceWidth = 300;
var faceHeight = 300;
var eyeWidth= 40;
var mouth=5;
var eyeball=10;
var nose=20;
var ear=150;
var inside=120;
var tongue=20;


 
function setup() {
    createCanvas(480, 600);
}
 
function draw() {
    background(200);// face shape
    fill(224, 211, 220);
    ellipse(width / 2, height /2, faceWidth,  faceHeight); 
    fill(252, 249, 243); //eye
    var eyeLX = width / 2 - faceWidth * 0.2;
    var eyeRX = width / 2 + faceWidth * 0.2;
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
    fill(0,0,0); //eyeball
    circle(eyeLX+5,height /2, eyeball,eyeball);
    circle(eyeRX-5,height/2,eyeball,eyeball);
    fill (0,0,0);//nose
    circle(width / 2, height /1.9, nose,nose);
    fill(224, 211, 220); //leftear
    circle(width/4,height/3,ear,ear);
    fill(224, 211, 220); //rightear
    circle(width/1.4,height/3,ear,ear);
    fill(245, 186, 227); //inside
    circle(width/3.7, height/2.8,inside,inside);
    circle(width/1.42, height/2.8,inside,inside);
    strokeWeight (2);
    fill(247, 134, 209) //mouth
    var mouth = width/7 - faceWidth * 0.5;
    ellipse( width/ 2, height/1.6, mouth, mouth/2);
    
}
 
function mousePressed() {
   
    faceWidth = random(200, 300);
    faceHeight = random(280, 300);
    eyeSize = random(20, 50);
    mouth = random(2,5);
    eyeball= random(7,19);
    hair = random(110,160);
    ear = random(140,170);
    inside = random(110,115);
}

I started off by using the original code given for this project. I randomly inserted numbers and variables to see how each code works out. Then I started to design the basic shapes and narrowed it down to the small details.

Leave a Reply