monicah1-project-02

sketch


var eyeSize = 20;
var circWidth = 160;
var circHeight = 200;
var earYcord = 190
var midx = 320 //x cordinate middle of the face
var midy = 200 //y cordinate middle of the face



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

function draw() {
	background (250,65,180);
	noStroke (0);
	fill (250,185,185);
	ellipse (midx,midy,circWidth,circHeight);
	ellipse (midx-80,earYcord,circWidth-120,circHeight-120);
	ellipse (midx+80,earYcord,circWidth-120,circHeight-120);
	fill (230,50,50);
	arc (midx,midy+50,50,80,0,PI+QUARTER_PI,OPEN);
	fill (0);
	ellipse (midx-18,midy+33,circWidth-145,circWidth-145);// mole

	fill (130,10,170);
	ellipse (midx-18,midy-30,circWidth-94,circWidth-94);//dark circle
	
    fill (250);
	ellipse (midx-18,midy-30,circWidth-120,circWidth-120);// left eyeball white
	ellipse (midx+18,midy-31,circWidth-110,circWidth-110);

	fill (0);
	ellipse (midx+7,midy-25,circWidth-130,circWidth-130);// right eyeball 
	ellipse (midx-16,midy-25,circWidth-130,circWidth-130);// left eyeball 
}

function mousePressed(){
	circWidth = random(100,200);
	circHeight = random(150,300);
	eyeSize = random(10,30);
}

I tried to use as much same variables as I can to simplify the code. I found it fun to use one x,y point to base on and finish the variable faces.

 

Leave a Reply