Xiaoying Meng- Project 2- Variable Faces

sketch

var earSize = 80;
var faceWidth = 300;
var faceHeight = 155;
var blushSize = 90;
var eyeSize =70;
var mouthHeight=122;
var y = 179;
 
function setup() {
    createCanvas(640, 480);
}
 
function draw() {
    background(0,0,0);
var earLX = width / 2 - faceWidth /2;
var earRX = width / 2 + faceWidth /2;



//ears
fill(0,0,0);
stroke(255,255,255);
strokeWeight(6);
ellipse(earLX, 180, earSize, earSize);
ellipse(earRX, 180, earSize, earSize);

//insideear
fill(255,255,255);
noStroke();
ellipse(earLX, 180, earSize/2, earSize/2);
ellipse(earRX, 180, earSize/2, earSize/2);

//head
stroke(255,255,255);
strokeWeight(6);
fill(0,0,0);
beginShape();
  curveVertex(87, 480); // the first control point
  curveVertex(87, 480); // is also the start point of curve
  curveVertex(115, 410);
  curveVertex(earLX, 200);
  curveVertex(width/2, faceHeight);
  curveVertex(earRX, 200);  
  curveVertex(525, 410);
  curveVertex(553, 480);// the last point of curve
  curveVertex(553, 480); // is also the last control point
  endShape();
//mouth
fill(255,255,255);
noStroke();
var mouthY = height-faceHeight+faceHeight/3;
ellipse(width/2,mouthY,170,mouthHeight);


//blush
fill(228,31,41);
noStroke();
ellipse(earLX-5,mouthY-5, blushSize,blushSize);
ellipse(earRX+5, mouthY-5,blushSize,blushSize);

//eyes
fill(255,255,255);
noStroke();
ellipse(width/2-80,mouthY-100,eyeSize,eyeSize);
ellipse(width/2+80,mouthY-100,eyeSize,eyeSize);

//insideeyes
fill(0,0,0);
noStroke();
ellipse(width/2-80,mouthY-100,eyeSize/3,eyeSize/3);
ellipse(width/2+80,mouthY-100,eyeSize/3,eyeSize/3);

//nose
var noseY =mouthY-mouthHeight/2+10;
quad(width/2, noseY, width/2+20, noseY+10, width/2, noseY+30,width/2-20, noseY+10);

//mouthinside
ellipse(width/2,mouthY+25,mouthHeight/5,mouthHeight/3);

//eyebrows
stroke(255,255,255);
noFill();
strokeWeight(6);
arc(width/2-80, mouthY-y, 40, 30, PI+1/3, TWO_PI-1/3);
arc(width/2+80, mouthY-y, 40, 30, PI+1/3, TWO_PI-1/3);
}

function mousePressed(){
	faceWidth = random(280, 310);
    faceHeight = random(140, 160);
    earSize = random(50, 90);
    blushSize = random(0,110);
    eyeSize =random(60,90);
    mouthHeight = random(100,130);
    y =random(150,180);
}

I first found a picture of Kumamon online and follow the basic shapes of its features. It’s a very interesting project for me. I started by locating the head, using three points on the top as variables. And go from there to describe its other features.

Leave a Reply