steven fei variable face
function setup() {
createCanvas(600, 600);
}
var shirtColor1 = 255
var faceRound = 300; /*100, 300*/
var hairX = 130; /*120, 135*/
var noseHeight = 295; /*295, 315*/
var noseTip = 20; /*10, 25*/
var mouth1 = 120; /*30, 120*/
var mouth2 = 30; /*1, 30*/
var eyebrow1 = 250; /*220, 255*/
var eyebrow2 = 230; /*200, 240*/
var eyeHeight = 60; /*50 , 80*/
var eyeballX = 230; /*210, 250*/
var eyeballY = 290; /* 290-eyeHeight/2-15, 290 + eyeHeigh/2 + 15*/
function draw() {
background(227,252,207);
//body
noStroke();
fill(shirtColor1,14,14);
rect(100, 450, 400, 140, 100, 100, 0,0);
noStroke();
fill(199,158,95);
triangle(240, 450, 300, 530, 360, 450);
//ear
noStroke();
fill(252,226,177);
circle(130, 300, 50);
noStroke();
fill(252, 226,177);
circle(470, 300, 50);
// face
noStroke();
fill(240,210,180);
rect(130,200, 340, 300, 0,0,faceRound, faceRound);
noStroke();
fill(252,226,177);
rect(150,200,300,290,0,0,faceRound, faceRound);
// hat
strokeWeight(1);
stroke(20);
fill(135,171,230);
arc(300, 200, 340, 250, PI, TWO_PI, PIE);
strokeWeight(1);
noStroke();
fill(93,129,186);
arc(300, 200, 300, 225, PI, TWO_PI,PIE);
// hat rim
strokeWeight(8);
stroke("black");
fill(240,217,180);
arc(300,210, 200,80, PI, TWO_PI, OPEN);
// eyes
noStroke();
fill("white");
ellipse(220, 290, 95, eyeHeight);
noStroke();
fill("white");
ellipse(380, 290, 95, eyeHeight);
//eyeball
stroke(100);
strokeWeight(3);
fill("black");
circle(eyeballX, eyeballY, 30);
stroke(100);
strokeWeight(3);
fill("black");
circle(eyeballX + 140, eyeballY, 30);
//hair
stroke(50);
strokeWeight(3);
fill(30);
triangle(130,200, 175, 200, hairX, 300);
stroke(50);
strokeWeight(3);
fill(30);
triangle(470,200, 425,200, 600-hairX ,300);
// eyebrow
stroke("black");
strokeWeight(5);
noFill();
beginShape();
curveVertex(150, 245);
curveVertex(150,245);
curveVertex(190, eyebrow2);
curveVertex(210, eyebrow2);
curveVertex(240, eyebrow1);
curveVertex(240, eyebrow1);
endShape();
stroke("black");
strokeWeight(5);
noFill();
beginShape();
curveVertex(450, 245);
curveVertex(450,245);
curveVertex(410, eyebrow2);
curveVertex(390, eyebrow2);
curveVertex(360, eyebrow1);
curveVertex(360, eyebrow1);
endShape();
//nose
fill(209,173,107);
noStroke();
triangle(300, noseHeight - 8, 280, 350, 320, 350);
fill(237,225,183);
noStroke();
triangle(300, noseHeight, 280, 350, 320, 350);
fill(237,225,183);
stroke(217,187,132);
strokeWeight(1);
arc(300, 350, 40, noseTip, 0, PI, OPEN);
// mouth
noStroke();
fill(217,108,102);
arc(300, 390, 180, mouth1, 0, PI, PIE);
noStroke();
fill(252,226,177);
arc(300, 390, 180, mouth2, 0, PI, PIE);
}
function mousePressed(){
shirtColor1 = random(10, 255);
faceRound = random(100,300); /*100, 300*/
hairX = random(120,135); /*120, 135*/
noseHeight = random(295,315); /*295, 315*/
noseTip = random(10,25); /*10, 25*/
mouth1 = random(30,120); /*30, 120*/
mouth2 = random(1,30); /*1, 30*/
eyebrow1 = random(220,255); /*220, 255*/
eyebrow2 = random(200,240); /*200, 240*/
eyeHeight = random(50,80); /*50 , 80*/
eyeballX = random(210,250); /*210, 250*/
eyeballY = random(290 - (eyeHeight/2) + 15, 290 + (eyeHeight/2) - 15); /* 290-eyeHeight/2-15, 290 + eyeHeigh/2 + 15*/
}