Generative Faces Project-02

I was trying to make the face resemble the style of characters from PowerPuff Girls and FairlyOdd Parents I really like the changing eye colors, which I did by replacing the g value in (r, g, b) with the variable eyeColor.

 

sketch index

//Arula Ratnakar
//Section C
//aratnaka@andrew.cmu.edu
//Generative Faces



var eyeSize = 20;
var faceWidth = 120;
var faceHeight = 150;
var pupil = 20//I said pupil but I meant iris
var mouth = 20
var hairWidth = 200
var hairHeight = 150
eyeColor = 7

function setup() {
    createCanvas(640, 480);
}
 
function draw() {
    background(170, 204, 235);
    noStroke ()
    ellipse (width /2, ((height/2)-20), hairWidth, hairHeight)//adds hair to the face
    fill (184, 151, 123)// colors the face
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    fill (0)
    ellipse (width/2, ((height/2)-50), 70, 70)
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    fill (255)
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
    fill (116,eyeColor, 183)
    ellipse (eyeRX, height /2, pupil, pupil)//adds right iris
    ellipse (eyeLX, height/2, pupil, pupil)//adds left iris
    fill(0)
    ellipse (eyeLX, height/2, pupil/2, pupil/2)//adds left pupil
    ellipse (eyeRX, height/2, pupil/2, pupil/2)//adds right pupil
    ellipse (width/2, 280, 30, mouth);//adds a mouth
   
}
 
function mousePressed() {
    faceWidth = random(100, 200);
    faceHeight = random(100, 160);
    eyeSize = random(20, 30);
    pupil = random (15, 20)
    mouth = random (1, 40)
    hairWidth = random (200, 350)
    eyeColor= random (1, 255)// changes the eyecolor


} 

Leave a Reply