//Name: Alessandra Fleck
//Class Section : B
//Email: afleck@andrew.cmu.edu
//Project-02
//Start values for face
//eyes
var eyeSize = 50;
var pupilSize = 20;
var pupilHeight = 20;
//face
var faceWidth = 200;
var faceHeight = 200;
var faceColor = 200;
//nose
var noseSize = 10;
//shirt
var shirtColor = 350;
//body
var bodyW = 300;
var bodyH = 350;
//mouth
var mouthSize_1 = 30;
var mouthSize_2 = 10;
//eyebrows
var eyebrowS = 60;
//hair
var hairColor = 100;
//left ear
var earWLeft = 65;
var earHLeft = 65;
//right ear
var earWRight = 65;
var earHRight = 65;
//left arm
var armWLeft = 50;
var armHLeft = 80;
var armWRight = 50;
var armHRight = 80;
function setup() {
createCanvas(640, 480);
}
function draw() {
background(232,195,230);
//set basic face parameters
//clouds
fill (189,223,185);
stroke('white');
ellipse();
fill(241,227,faceColor);
stroke(65,66,64);
strokeWeight(4);
ellipse(width / 2, height / 2, faceWidth, faceHeight);
//change shirt color + make body
fill (204,191,shirtColor);
stroke(65,66,64);
strokeWeight(3);
ellipse (width / 2, height / 2 + faceHeight * 0.5 + bodyH * 0.5, bodyW, bodyH);
//body spot
fill (204,191,162);
stroke('white');
strokeWeight(3);
ellipse (width / 2, height / 2 + faceHeight * 0.5 + bodyH * 0.5, bodyW / 2, bodyH / 2 + 80);
//mouth shade
fill(204,191,162);
stroke(214,199,181);
ellipse (width /2, 280, 100,100);
//set left + right eye values
fill ('white');
stroke('white');
var eyeLX = width / 2 - faceWidth * 0.25;
var eyeRX = width / 2 + faceWidth * 0.25;
ellipse(eyeLX, height / 2, eyeSize, eyeSize);
ellipse(eyeRX, height / 2, eyeSize, eyeSize);
//eye pupil values
fill ('black');
noStroke();
var eyeLP = width / 2 - faceWidth * 0.25;
var eyeRP = width / 2 + faceWidth * 0.25;
ellipse(eyeLP, height / 2, pupilSize, pupilHeight);
ellipse(eyeRP, height / 2, pupilSize, pupilHeight);
//eyebrows
noFill();
stroke('brown');
strokeWeight(5);
// arc(x, y, w, h, start, stop, [model])
arc(eyeLX, height / 2, eyebrowS, eyebrowS, PI + QUARTER_PI, TWO_PI - QUARTER_PI);
arc(eyeRX, height / 2, eyebrowS, eyebrowS, PI + QUARTER_PI, TWO_PI - QUARTER_PI);
//mouth
fill ('red');
stroke(228,140,226);
ellipse(width / 2, 280, mouthSize_1, mouthSize_2);
//nose
fill ('brown');
noStroke();
ellipse(width / 2, height / 2 + 20, 20,10);
//ears
//left ear
fill (143,123,77);
stroke('white');
ellipse(width / 2 + faceWidth * 0.20 + earWLeft, height / 2 -80, earWLeft, earHLeft);
//right ear
fill (143,123,77);
stroke('white');
ellipse(width / 2 - faceWidth * 0.20 - earWRight, height / 2 -80, earWRight, earHRight);
//left paw
fill (143,123,77);
stroke('black');
ellipse(width / 2 - bodyW * 0.20 - armWRight -10, height / 2 + 230, armWRight+50, armHRight);
//right paw
fill (143,123,77);
stroke('black');
ellipse(width / 2 - bodyW * 0.20 + armWRight + 120, height / 2 + 230, armWRight+50, armHRight);
}
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.
faceWidth = random(200, 300);
faceHeight = random(200, 400);
eyeSize = random(10, 50);
pupilSize = random(5, 15);
pupilHeight = random(1,20);
bodyW = random(100,300);
shirtColor = random(100,500);
faceColor = random(150,250);
mouthSize_1 = random(30, 50);
mouthSize_2 = random(10,30);
eyebrowS = random(20,80);
//variable ear sizes
}
For this project I just wanted to rely on simple shapes that move together. Since one rudimentary shape is a circle, I ended up making a bear. Next time when I approach a project such as this, I will want to make sure that all components stay flush with one another, despite the random variable change of their sizes.