Carly Sacco – Project 02 – Variable Face

sketch

//Carly Sacco
//Section C
//csacco@andrew.cmu.edu
//Project - 02 

var eyeSize = 20
var leftLeg = 20
var rightLeg = 20
var mouthSize = 40

var armX = 365
var armY = -90

var backColor = 100

function setup() {
    createCanvas(640, 480);
}
function draw () {
    background(100, 100, backColor);
	
	//body
	fill(255, 255, 255);
	noStroke();
	//ellipse(325,300,150,150);
	//rect(250, 200,150, 60, 60);
	rect(250, 150, 150, 275, 90, 90, leftLeg, rightLeg);
	
	//eyes
	fill(0);
	ellipse(300, 200, 15, eyeSize);
    ellipse(350, 200, eyeSize, 15);	
	
	//mouth
	fill(0);
	ellipse(325, 250, mouthSize, mouthSize);
	
	//leftarm
	fill(255);
    rotate(PI / 3.0);
    rect(armX, armY, 40, 60, 90, 0, 90, 0);
	rect(armX + 55, armY - 160, 40, 60, 0, 90, 0, 90);
}
function mousePressed() {
	leftLeg = random(30, 90);
	rightLeg = random(90, 30);
	eyeSize = random(10, 45);
	mouthSize = random(40,80);
	armX = random(365, 380);
	armY = random(-80, -100);
	backColor = random(0, 300);
}

After I decided I wanted my variable face to represent a ghost, I thought of all the aspects of the ghost that could change. This lead to me create randomized variations of changes to the body, face, and arms.

Leave a Reply