Variable-Face
var eyeSpacing = 80;
var noseLength = 120;
var mouthWidth = 120;
var mouthHeight = 100;
function setup() {
createCanvas(480,640);
background(200);
}
function draw() {
//head
fill(255,255,255);
ellipse(240,320,360,440);
//eyes
fill(0,0,0);
ellipse(240+eyeSpacing, 300, 50, 80);
ellipse(240-eyeSpacing, 300, 50, 80);
//nose
fill(255);
triangle(240, 300, 200, 300+noseLength, 280, 300+noseLength);
//mouth
arc(240, 400, mouthWidth, mouthHeight, 0, PI, CHORD)
//check for user input
if(mouseIsPressed) {
eyeSpacing = random(50,100);
noseLength = random(40,80);
mouthWidth = random(120,240);
mouthHeight = random(100,200);
}
}
Phew I think I uploaded this correctly! Honestly the hardest part of the assignment was figuring out how to do the HTML stuff. Although very simple, I like my final product since it’s always smiling at me 😀