generative-faces
//Owen Fox
//Section C
//olf@andrew.cmu.edu
//generative faces
var rectX = 300;
var rectY = 300;
var eyeX = 100;
var eyeY = 50;
var eyeball = 20;
var mW = 100;
var mH = 20;
var n = 25
function setup() {
createCanvas(600, 600);
}
function draw() {
var w = width/2;
var h = height/2;
background(120);
//head
fill("#ff0080");
rectMode(CENTER);
noStroke();
rect(w,h,rectX,rectY);
//eyes
fill("#ffe6f2");
ellipse(w-100,h,eyeX,eyeY);
ellipse(w+100,h,eyeX,eyeY);
//eyeballs
fill("#660033");
ellipse(200,300,eyeball,eyeball);
ellipse(400,300,eyeball,eyeball);
//nose
fill("#e60073")
quad(w-n,h-2*n,w+n,h-2*n,w+2*n,h+2*n,w-2*n,h+2*n);
fill("#b30059");
quad(w-n,h-2*n,w,h-2*n,w,h+2*n,w-2*n,h+2*n);
//mouth
fill("#ff99cc");
rect(width/2,height/2+rectY/3,mW,mH,mH/2);
}
function mousePressed() {
rectX = random(150, 450);
rectY = random(150, 450);
eyeX = random (50,150);
eyeY = random (25,75);
eyeball = random (10,30);
n = random (15,35);
mW = random (75,125);
mH = random (15,35);
}