# Jdbrown – Project 2: Electric Boogaloo

``````// Joshua Brown
// Jdbrown@andrew.cmu.edu
// Section C
// Project 2: Face Generation

var faceWidth = 200;
var faceHeight = 150;

function setup () {
createCanvas (640, 480);
}

function draw () {
background (190, 50, 90);
noStroke ();

fill (random (30, 60), random (60, 120), random (90, 180));

// Drawing background triangles

triangle (0, 480, 240, 480, 240, 240);  // idk why not
triangle (640, 480, 400, 480, 400, 240);  // idk why not
triangle (0, 0, 240, 0, 240, 240);  // idk why not
triangle (640, 0, 400, 0, 400, 240); // idk why not

// Drawing actual face

fill (255);
ellipse (width / 2, height / 3 + 50, width / 4, height / 3);    // drawing face outline

fill (200);
ellipse (width / 2, height / 3 + 50, width / 6, height / 5);    // drawing face outline

stroke (0);
strokeWeight (5);

fill (255);
ellipse (width / 3 + 75, height / 3 + 25, width / 12, height / 9);    // drawing eye socket (L)
ellipse (width / 3 + 140, height / 3 + 25, width / 12, height / 9);    // drawing eye socket (R)

noFill ();

ellipse (width / 3 + 75, height / 3 + 25, width / 16, height / 12);     // drawing eyeball Ring1 (L)
ellipse (width / 3 + 140, height / 3 + 25, width / 16, height / 12);    // drawing eyeball Ring1 (R)
ellipse (width / 3 + 75, height / 3 + 25, width / 24, height / 20);     // drawing eyeball Ring2 (L)
ellipse (width / 3 + 140, height / 3 + 25, width / 24, height / 20);    // drawing eyeball Ring2 (R)

fill (random (30, 60), random (60, 120), random (90, 180));

ellipse (width / 3 + 75, height / 3 + 25, width / 52, height / 40);     // drawing eyeball Ring1 (L)
ellipse (width / 3 + 140, height / 3 + 25, width / 52, height / 40);    // drawing eyeball Ring1 (R)

ellipse (width / 2, height / 3 - 65, faceWidth / 10, faceHeight / 6);   // drawing third eye

ellipse (width / 2, height / 3 + 185, faceWidth / 10, faceHeight / 6);   // drawing third eye blind

fill (0);
arc (width / 2, height / 2, width / 6, faceHeight / 6, 90, PI); // drawing mouth

}

function mousePressed () {

width = random (160, 1280) + random (10, 50);
height = random (120, 920) + random (10, 50);

}

``````

This project went through a few iterations, but the most challenging aspect was that I discovered “random” commands. As you can see, I couldn’t help myself, and there’s a psychedelic quality to the overall presentation. Sorry ’bout it.

Josh