var bunW = 106;
var bunH = 88;
var bangsShowH = 166;
var bangsShowW = 305;
var bangsHideH = 83;
var bangsHideW = 305;
var faceWidth = 329;
var faceHeight = 267;
var eyesW = 44;
var eyesH = 31;
var pupilsA = 12;
var pupilsB = 12;
var pupilsXL = 235;
var pupilsY = 259;
var pupilsXR = pupilsXL + 140;
var mouthW = 74;
var mouthH = 21;
var mouthX = 336;
var mouthY = 341;
var backgroundR = 102;
var backgroundG = 45;
var backgroundB = 145;
var haircolor = 0;
function setup() {
createCanvas(640, 480);
noStroke();
}
function draw() {
//background
background(backgroundR,backgroundG,backgroundB);
//face
fill(240,199,156);
noStroke();
ellipse(320 , 267, faceWidth, faceHeight);
//bun hair
fill(haircolor);
noStroke();
ellipse(208,143,bunW,bunH);
ellipse(431,143,bunW,bunH);
//bangs hair
fill(haircolor);
noStroke();
ellipse(320,192,bangsShowW,bangsShowH);
rectMode(RADIUS);
noStroke();
fill(240,199,156);
rect(321,252,bangsHideW/2,bangsHideH/2);
//hair pins
stroke(238,28,72);
strokeWeight(3);
line(172,175,254,120);
line(386,120,467,175);
//eyes
fill(255);
noStroke();
ellipse(243,256,eyesW,eyesH);
ellipse(381,256,eyesW,eyesH);
//pupils
fill(0);
ellipse(pupilsXL,pupilsY,pupilsA,pupilsB);
ellipse(pupilsXR,pupilsY,pupilsA,pupilsB);
//nose
fill(170,134,77);
ellipse(304,291,30,21);
fill(240,199,156);
ellipse(305,285,30,21);
//mouth
fill(0);
ellipse(mouthX,mouthY,mouthW,mouthH);
}
function mousePressed() {
faceWidth = random(245,348);
faceHeight = random(272,309);
bangsHideW = random(236,250);
bangsHideH = random(50,100);
haircolor = random(0,255);
eyesW = random(44,60);
eyesH = random(31,52);
pupilsXL = random(229,260);
pupilsY = random(248,267);
pupilsA = random(11,29);
pupilsB = random(11,30);
mouthX = random(284,378);
mouthY = random(338,364);
mouthW = random(33,92);
mouthH = random(15,63);
backgroundR = random(0,225);
backgroundG = random(0,225);
backgroundB = random(0,225);
}
For this project, I explored how to make a variety of expressions using random variables. At first it was a challenge to figure out the relationships between each variable, but it got easier after I made several errors.