Paul Greenway – Project – 02

sketch

// Simple beginning template for variable face.
var eyeSize = 20;
var eyeLocation = -70;
var noseSize = 40;
var mouth = 60;
var shirtColor = 10;
var hairColor = 10;
 
function setup() {
    createCanvas(480, 640);
}
 
function draw() {
   
    background(255);
  
     //hair
     fill(hairColor);
     arc(240, 300, 350, 350, PI, TWO_PI);
  
     //hair
     fill(hairColor);
     arc(230, 240, 340, 290, PI, 180 + HALF_PI, OPEN);
  
  
  translate(250, 300);
  fill(200); 
  
  //body
  noStroke();
  fill(shirtColor,100,30);
  rect(-100,150,200,300);
  arc(0, 150, 200, 100, PI, TWO_PI,PIE);


  
  //face
  beginShape();
  fill(200);
  curveVertex(-113,-120);
  curveVertex(-3,-150);
  curveVertex(83,-98);
  curveVertex(80,-6);
  curveVertex(95,101);
  curveVertex(3,130);
  curveVertex(-106,88);
  curveVertex(-110,-6);
  curveVertex(-113,-120);
  curveVertex(-3,-150);
  curveVertex(83,-98); 

endShape();
  
  //eyes
  fill(255);
  circle(50,eyeLocation,eyeSize);
  circle(eyeLocation,eyeLocation,eyeSize);
  
  
  //nose
  fill(180);
  ellipse(0,0,30,noseSize);
  
  //mouth
  fill(80);
  arc(-5, 60, 120, mouth, 0, PI, PIE);
  
  
}
 
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.

    eyeSize = random(10, 30);
    eyeLocation = random(-70, -40);
    noseSize = random(30, 70);
    mouth = random(30, 120);
    shirtColor = random(10,255);
    hairColor = random(10,100);
}

Variable Face

For this project I wanted to create a simple, cartoonish face that could look different as the dimensions of the facial features shift. The elements of the face that I used variables on are the mouth, nose, eyes, as well as shirt and hair colors.

Leave a Reply