//Rebecca Enright
//Section A
//renright@andrew.cmu.edu
//Project-02: Variable Faces
var head = 100
var eye = 50
var brow = 40
function setup() {
createCanvas(640,480);
}
function draw() {
background(0,171,255);
//create conditional head
if (mouseIsPressed) {
fill(115,252,19);
ellipse(320,240,head+100,head/2);
} else {
fill(255,207,153);
ellipse(320,240,head,head);
}
//create conditional eyes
if (mouseIsPressed) {
//creates whites of eyes
fill(255);
ellipse(300,200,eye,eye);
ellipse(340,200,eye,eye);
//creates pupils
fill(0);
ellipse(300,200,eye/2,eye/2);
ellipse(340,200,eye/2,eye/2);
} else {
//creates whites of eyes
fill(255);
ellipse(300,220,eye/2,eye/2);
ellipse(340,220,eye/2,eye/2);
//creates pupils
fill(0);
ellipse(300,220,eye/4,eye/4);
ellipse(340,220,eye/4,eye/4);
}
//creates condidtional mouth
if (mouseIsPressed) {
//creates tounge
fill(255,104,153);
arc(320,240,25,100,TWO_PI,PI);
} else {
//creates open mouth
fill(0);
arc(320,250,40,75,TWO_PI,PI);
}
//creates conditional features
if (mouseIsPressed) {
//creates eyebrows
fill(0);
rect(320,150,brow,brow/2);
rect(270,150,brow,brow/2);
} else {
//creates crown
fill(255,255,0);
rect(300,180,brow,brow/2);
}
}
This project was a lot of fun, I really like learning about how to make things interactive. It was tricky at first, but it became easier as I worked on it.