Project-02-Variable Face

sketchDownload
//Jiayu Xu
//Section A
var bodyWidth=450;
var bodyHeight=400;
var handWidth=90;
var handHeight=100;
var feetWidth=110;
var feetHeight=90;
var eyeDiameter=60;
var teethWidth=60;
var teethHeight=30;
var eyeBrowrightX=213;
var eyeBrowrightY=120;
var eyeBrowleftX=427;
var eyeBrowleftY=175;
var mouthWidth=243;
var mouthHeight=160;
var righthandHeight=240;
var lefthandHeight=240;
function setup() {
    createCanvas(640,480);
    background(random(204,255),random(204,255),random(204,255));
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
	stroke(0);
	strokeWeight(8);
	fill(153,76,0);
	ellipse(width/2-bodyWidth/2-20, righthandHeight, handWidth, handHeight);//righthand
	ellipse(width/2+bodyWidth/2+20, lefthandHeight, handWidth, handHeight);//lefthand
	ellipse(width*1/3, height-50, feetWidth, feetHeight);//rightfeet
    ellipse(width*2/3, height-50, feetWidth, feetHeight);//leftfeet
	fill(195,126,48);
	ellipse(width/2,height/2,bodyWidth,bodyHeight);  //body
	strokeWeight(30);
	line(eyeBrowrightX, eyeBrowrightY, width/3+60, height/4+50);//right eyebrow
	strokeWeight(8);
	line(eyeBrowleftX, eyeBrowleftY, width*2/3-60, height/4+55);//left eyebrow
	fill(0);
	circle(width/2-70, height/2-10, eyeDiameter);//righteye
	circle(width/2+70,height/2-10, eyeDiameter);//lefteye
	fill(153,76,0);
    arc(width/2,height*3/5, mouthWidth, mouthHeight, 0, PI);//mouth
    
    fill(255);
    noStroke();
    rect(width/2-teethWidth/2, height*3/5, teethWidth, teethHeight);//teeth
}

function mousePressed() {
	clear();
	bodyWidth=random(400,451);
	bodyHeight=random(300,400);
	eyeDiameter=random(40,70);
	eyeBrowrightX=random(200,220);
	eyeBrowrightY=random(120,200);
	eyeBrowleftY=random(150,180);
	mouthWidth=random(200,300);
	mouthHeight=random(0,160);
	righthandHeight=random(200,300);
	lefthandHeight=random(200,300);
	handWidth=random(80,100);
	handHeight=random(90,108)
	background(random(204,255),random(204,255),random(204,255));



}

The face in my work is “Shooky” from BT21, which is a cartoon character designed by Suga from BTS. I chose it because it can be easily represented by basic geometric figures and I would love to see how its facial expressions change after every click.

BT21 - LINE FRIENDS INC

Leave a Reply