Little Boy
Gif of piece
Little Boy
I imagine this program to be an overbearing aunt pulling the cheek of a little boy and the faces he makes at the incredibly uncomfortable situation. I linked the top of his hat to his actual face so it would stretch along with his cheeks and constrained the pupils in the eyes by creating an if statement that would resize them if the random generator ever attempted to make them greater than the size of the whites. I allowed for them to be equal however. I did a similar function for the blush, also randomizing the shade of the alpha.
EDITED: I added a moving gif of the project
float m1= 50;//whites of eyes
float resize=150;//adding to face shape
float mou= 55;//mouth
float fshape=450;
float leftfa=100;//changing the width of left side of face
float rightfa=500;//changing width of right side of face
float leftcap=leftfa;
float rightcap=rightfa;//making sure when clicked the right side of cap is connected to the right side of face
float bball=25;//pupil
//creating shape group
float blush=25;//blush size
float shadeblush=93;//shade of pink of blush
float visblush=0;//alpha value of blush
float blushheight=190;
void setup(){
size(600,600);
}
void draw(){
translate(0, 100);
background(108,155,224);
//drawing face
beginShape();
fill(165,68,10);
stroke(3);
curveVertex(resize,100);
curveVertex(leftfa,100);
curveVertex(resize,300);
curveVertex(fshape,300);
curveVertex(rightfa,100);
curveVertex(450,100);
endShape(CLOSE);
// drawing cap cap
beginShape();
fill(0,0,255);
stroke(10);
curveVertex(150,300);
curveVertex(leftcap,100);
curveVertex(300,25);
curveVertex(rightcap,100);
curveVertex(450,300);
endShape(CLOSE);
//top of cap
beginShape();//inside cap skin
fill(165,68,10);
stroke(10);
curveVertex(250,100);
curveVertex(250,80);
curveVertex(300,55);
curveVertex(350,80);
curveVertex(350,100);
endShape(CLOSE);
//eye1
fill(255,255,255);
ellipse(375,150,m1,m1);
//eye2
ellipse(200,150,m1,m1);
fill(0,0,0);
//eyeball1
ellipse(375,150,25,bball);
//eyeball2
ellipse(200,150,25,bball);
//mouth
rect(255, 200,mou,m1);
//blush
noStroke();
fill(210,shadeblush,151,visblush);
ellipse(200,blushheight,75,blush);
ellipse(400,blushheight,75,blush);
}
void mousePressed(){
m1= random(100);
mou= random(100);
bball= random(25,75);
if (bball>=m1){//making sure the pupils is less then or equal to the size of the eye
bball=25;
}
if (m1==50){//making sure the blush isn't ontop of pupil
blushheight= 200;
}if (m1>=50){
blushheight=225;}
else{
blushheight=190;
}
resize= random(150,200);
leftfa= random(100);//changing width position of left side of face
rightfa= random(500,600);
leftcap= leftfa;
rightcap= rightfa;
shadeblush= random(129);
visblush= random(0,129);
}