sketch
//Zee Salman
//SECTION E
//fawziyas@andrew.cmu.edu
//Project-02-Variable-Face
// Simple beginning template for variable face.
//color for backgroung and earrings
var color1 = 100;
var color2 = 10;
var color3 = 30;
var eyeSize = 20;
//starter face
var faceWidth = 280;
var faceHeight = 340;
var eyecolor1 = 150;
var eyecolor2= 200;
var eyecolor3= 20;
var faceColor1 = 168
var faceColor2 = 84
var faceColor3 = 29
var nose = 30
//skin color variation
var skin1 = [141, 85, 36];
var skin2 = [198, 134, 66];
var skin3 = [224, 172, 105];
var skin4 = [241, 194, 125];
var skin5 = [255, 219, 172];
var skin6 = [255, 237, 209];
let skinPicks = [skin1, skin2, skin3, skin4,skin5, skin6]
//nose color
var noseColor1 = [92, 44, 22];
var noseColor2 = [173, 122, 83];
var noseColor3 = [196, 152, 84];
let noseColorPicks = [noseColor1, noseColor2, noseColor3]
var skinColor = skin3
var noseColor = noseColor1
//neck shadow color
var neckShadow1 = [87, 47, 21];
var neckShadow2 = [92, 44, 22];
var neckShadowPicks = [neckShadow1, neckShadow2]
var neckShadowColor = neckShadow1
//smile variation
var smile1 = faceWidth/2.1
var smile2 = faceWidth/2.8
var smile3 = faceWidth/3.2
var smilePick = smile3
let smiles = [smile1, smile2, smile3]
var smileColor1 = [140,25,69];
var smileColor2 = [201,125,154];
let smileColorPicks = [smileColor1, smileColor2]
var smileColor = smileColor1
var eyebrowsize = 7
function setup() {
createCanvas(600, 600);
}
function draw() {
background(color1, color2, color3)
//Hair
fill('black')
ellipse(width / 2.6, height / 2, faceWidth, faceHeight / 1);
ellipse(width / 1.6, height / 2, faceWidth, faceHeight / 1);
//Neck
fill(skinColor)
noStroke()
rect(width / 2.6, height / 2, faceWidth / 2, faceHeight / 1.6);
//Neck Shadow
fill(neckShadowColor)
ellipse(width / 2, height * .65, faceWidth / 1.7, faceHeight / 1.6);
//head
fill(skinColor)
strokeWeight(2)
ellipse(width / 2, height / 2, faceWidth, faceHeight);
//Ball on top of the Head
fill('black')
arc(width/2, height/4.5, faceWidth / 2,faceHeight/4,180, PI, OPEN);
//eyes
var eyeLX = width / 2 - faceWidth * 0.25;
var eyeRX = width / 2 + faceWidth * 0.25;
fill('white')
var earLX = width / 2 - faceWidth * 0.5;
var earRX = width / 2 + faceWidth * 0.5;
//Iris
ellipse(eyeLX, height / 2, eyeSize * 2, eyeSize);
ellipse(eyeRX, height / 2, eyeSize * 2, eyeSize);
fill(eyecolor1,eyecolor2,eyecolor3)
ellipse(eyeLX, height / 2, eyeSize, eyeSize);
ellipse(eyeRX, height / 2, eyeSize, eyeSize);
//Pupil
fill('black')
ellipse(eyeLX, height / 2, eyeSize * .35, eyeSize * .35);
ellipse(eyeRX, height / 2, eyeSize * .35, eyeSize * .35);
//EYEBROWS
stroke('black');
strokeWeight(eyebrowsize);
noFill();
beginShape();
curveVertex(190, 350);
curveVertex(200,265);
curveVertex(260, 266);
curveVertex(210, 296);
endShape();
stroke('black');
strokeWeight(eyebrowsize);
noFill();
beginShape();
curveVertex(330, 350);
curveVertex(340,265);
curveVertex(400, 266);
curveVertex(350, 296);
endShape();
//Ears
stroke(color2, color3, color1)
noFill()
ellipse(earLX, height / 1.7, eyeSize * .5, eyeSize * 1.3);
ellipse(earRX, height / 1.7, eyeSize * .5, eyeSize * 1.3);
noStroke()
fill(skinColor)
ellipse(earLX, height / 1.9, eyeSize * .75, eyeSize * .9);
ellipse(earRX, height / 1.9, eyeSize * .75, eyeSize * .9);
//nose
noStroke()
fill(noseColor)
ellipse(295,340,nose,19)
//mouth
fill(smileColor)
arc(width/2, height/1.6, smilePick,faceHeight/5,0, PI, CHORD);
}
function mousePressed() {
faceWidth = random(260, 300);
faceHeight = random(320, 400);
eyeSize = random(20, 50);
eyecolor1 = random(100,200);
eyecolor2 = random(90,150);
eyecolor3 = random(10,50);
nose= random(10,60)
skinColor = random(skinPicks);
neckShadowColor = random(neckShadowPicks);
noseColor = random(noseColorPicks);
smilePick = random(smiles);
smileColor = random(smileColorPicks);
//background/earring color
color1 = random(1,200);
color2 = random(1,150);
color3 = random(1, 200);
eyebrowsize = random(3,8);
}
In doing this project, I wanted to make the faces look sort of like mt self portrait but with more details. It took a while to get what I wanted but Im really happy with what came out. I also got really comfortable with using lists and Im really excited to advance it even more.