Project-02-Charlie Mo

sketch

var eyeHeight=15;
var eyeWidth=55;
var noseSize=6;
var browHeight1=2;
var browHeight2=2;
var faceWidth=200;
var faceHeight=250;
var ballSize=10;
var mouthLength=40;




function setup() {
    createCanvas(480, 640);
    background(253,255,75);
    
}

function draw() {

	//face
	fill(255);
	ellipse(width/2,height/2,faceWidth,faceHeight);

	//eye
	var eyeLX= width/2-faceWidth*0.3;
	var eyeLY= height/2+faceHeight*0.1;
	var eyeRX= width/2+faceWidth*0.2;
	var eyeRY= height/2+faceHeight*0.1;
	fill(255);
	ellipse(eyeLX,eyeLY,eyeWidth,eyeHeight);
	ellipse(eyeRX,eyeRY,eyeWidth,eyeHeight);

	//eyeballs
	fill(0);
	ellipse(eyeLX,eyeLY,ballSize,ballSize);
	ellipse(eyeRX,eyeRY,ballSize,ballSize);

	//nose
	var noseLX= width/2-faceWidth*0.08;
	var noseLY= height/2+faceHeight*0.2;
	var noseRX= width/2+faceWidth*0.000000000001;
	var noseRY= height/2+faceHeight*0.2;
	fill(0);
	ellipse(noseLX,noseLY,noseSize,noseSize);
	ellipse(noseRX,noseRY,noseSize,noseSize);

	//brow
	var browLX= width/2-faceWidth*0.45;
	var browLY= height/2+faceHeight*0.01;
	var browRX= width/2+faceWidth*0.1;
	var browRY= height/2+faceHeight*0.01;
	fill(0);
	rect(browLX,browLY,50,browHeight1);
	rect(browRX,browRY,50,browHeight2);

	//mouth
	var mouthX= width/2-faceWidth*0.08;
	var mouthY= height/2+faceHeight*0.27;
	rect(mouthX,mouthY,15,mouthLength);

}

function mousePressed() {
    //change nostril size
    noseSize = random(6,12);

    //change pupil size
    ballSize = random(2,12);

    //change mouth size
    mouthLength = random(10, 55);
}

		


Leave a Reply