sketch
/*
Min Jun Kim
minjunki@andrew.cmu.edu
15104-B
Project 2
*/
var reee = 150
var faceDiff = 0.8
var faceCol = 250
var eyeSize = 30
var eyeDiff = 0.8
var pupilCol = 1
var browSlant= 10
var mouthFill = 100
var mouthSize = 30
var noseWidth = 10
var noseHeight = 25
var backColor = 100
var browS = 2
var hatHeight=100
function setup() {
createCanvas(640, 480);
}
function draw() {
'background design'
noStroke();
'green background'
background(107,209,150);
'aqua background'
fill(110,206,251);
rect(0,0,width*3/4,height);
'dark blue background'
fill(97,128,234);
rect(0,0,width/2,height);
'regular blue background'
fill(80,146,247);
rect(0,0,width/4,height);
'stripe'
fill(255,235,250);
quad(0,230,0,170,170,0,230,0);
'face color'
fill(255, faceCol,180);
'face'
ellipse(width/2, height/2, reee*faceDiff,reee);
'eye fill'
fill(250,250,250);
'eyes left'
ellipse(width/2-reee*faceDiff*0.25,height/2, eyeSize, eyeSize*eyeDiff);
'eyes right'
ellipse(width/2+reee*faceDiff*0.25, height/2, eyeSize,eyeSize*eyeDiff);
'eye fill'
fill(100, 100, pupilCol);
'pupil left'
ellipse(width/2-reee*faceDiff*0.25,height/2, 10, 10);
'pupil right'
ellipse(width/2+reee*faceDiff*0.25, height/2, 10,10);
'brow power'
stroke(1);
strokeWeight(browS);
'eyebrow left'
line(width/2-reee*faceDiff*0.35 ,height/2-reee*faceDiff*0.2+browSlant, width/2-reee*0.1, height/2-reee*0.1);
'eyebrow right'
line(width/2+reee*faceDiff*0.35 ,height/2-reee*faceDiff*0.2+browSlant, width/2+reee*0.1, height/2-reee*0.1);
noStroke();
'mouth fill'
fill(255,100,mouthFill);
'mouth'
ellipse(width/2,height/2+reee*0.28,10+mouthSize,10);
'nose fill'
fill(255,175,123);
'nose'
triangle(width/2-noseWidth,height/2+reee*0.15, width/2+noseWidth, height/2+reee*0.15, width/2, height/2+reee*0.15-noseHeight);
'hat'
stroke(1);
strokeWeight(3);
line(width/2-110,height/2-reee*0.2,width/2+110,height/2-reee*0.2);
fill(1)
rect(width/2-reee*faceDiff*0.45,hatHeight,reee*faceDiff*0.9,height/2-reee*0.2-hatHeight);
}
function mousePressed() {
reee = random(130,230);
faceDiff= random(0.7,1);
faceCol = random(190,220);
eyeSize = random(20,35);
eyeDiff= random(0.6,1);
pupilCol = random(1,250);
browSlant = random(1,12);
mouthFill = random(1,255);
mouthSize = random(1,30);
noseWidth = random(8,15);
noseHeight = random(20,30);
browS = random(1,3);
hatHeight = random(0,100);
}
This is my project 2 variable face. It was actually quite fun to do because I got to see a large number of faces. I wanted to do a British soldier inspired piece. It took a bit longer than I wanted though haha.