Han Yu Project 2 Variable Face

sketch

// Han Yu
// Section D
// hyu1@andrew.cmu.edu
// Project-02

var facew = 200
var faceh = 200
var color1 = 219 
var color2 = 255
var color3 = 238
var eyesize = 5
var pupildiff = 40
var mouthopen = 10

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

function draw() {
	background(219,255,238);
	//bubbles
	noFill();
	ellipse(500,80,180,120);
	ellipse(480,180,50,35);
	//word
    textSize(35);
    strokeWeight(4);
	text("wut?",470,100);
	//face
	fill(219,255,238);
	stroke(249,192,180);
	strokeWeight(6);
	rect(width*0.2,height*0.15,facew,faceh,10);
	//body
	rect(width*0.4,height*0.15+faceh,facew*0.7,300,10);
	//book
	fill(color1,color2,color3);
	rect(width*0.4*0.8,(height*0.15+faceh)*1.3,facew*0.7*0.8,200,10);
	//eye
	fill(249,192,180);
	stroke(249,192,180);
	strokeWeight(6);
	ellipse(width*0.2+facew/5,height*0.15+faceh/4,eyesize,eyesize);
    ellipse(width*0.2+facew/5+pupildiff,height*0.15+faceh/4,eyesize,eyesize);
	//mouth
	fill(254,225,124);
	rect(width*0.2+facew/4,height*0.15+faceh/3,facew/2,faceh/2+mouthopen,10);
	//teeth
	fill(255);
	rect(width*0.2+facew/3.5,height*0.15+faceh/3,facew/8,faceh/10,10);
	rect(width*0.2+facew/3.5+(facew/2)*0.6,height*0.15+faceh/3,facew/8,faceh/10,10);
}


function mousePressed() {
    facew = random(150,300);
    faceh = random(150,280);
    color1 = random(165,255);
    color2 = random(165,255);
    color3 = random(195,255);
    eyesize = random(5,22);
    pupildiff = random(40,100);
    mouthopen = random(-50,20);
}

I was inspired by Domo the brown monster when I first started my project. But later I decided to make a meme-like character with a melodramatic expression while doing something. Overall, I feel like this project is challenging but enjoyable.

Leave a Reply