Alex Face Changer
This was the assignment I decided to start out with. It was quite a challenge and more of an experience/ experimental piece. Fun fact: I figured out how to randomize the color on my own before we were taught it in class. so, that was a very proud accomplishment of mine, which is kind of sad. My second modification was adding a mouth to the example face. For this used a triangle to stick to the simple geometric shape aesthetic. I then continued to have the mouth shape randomize. My third modification was adding pupils and getting the position of the eye and pupils to move with ever frame.
float eyeSize = 20;
float eyePlace = height/2;
float faceWidth = 100;
float faceHeight = 120;
float mouthWidth = 50;
float mouthHeight = 200;
int red=255;
int blue=255;
int green=255;
void setup(){
size(300,300);
frameRate (2);
}
void draw(){
background(180);
float clampedX = constrain(mouseX, faceWidth, faceWidth);
fill(red, green, blue);
ellipse (width/2, height/2, faceWidth, faceHeight);
fill(red/2,green/2, blue/2);
float eyeLX = width/2 - faceWidth*0.25;
float eyeRX = width/2 + faceWidth*0.25;
ellipse (eyeLX, eyePlace, eyeSize, eyeSize);
ellipse (eyeRX, eyePlace, eyeSize, eyeSize);
float mouthLX = width/2 - faceWidth*0.25;
float mouthRX = width/2 + faceWidth*0.25;
float mouthHX = mouthHeight + faceHeight*0.25;
triangle (mouthLX/2,170, mouthRX+70, 170, width/2+70, mouthHX);
fill(0);
ellipse (eyeLX, eyePlace, eyeSize/2, eyeSize/2);
ellipse (eyeRX, eyePlace, eyeSize/2, eyeSize/2);
faceWidth = random (75, 150);
faceHeight = random (100, 200);
eyeSize = random (10, 30);
mouthWidth = random (25, mouthHeight);
mouthHeight = random (150, 225);
eyePlace = random (100, 150);
}
void mousePressed(){
red = int(random(0,256));
blue = int(random(0,256));
green = int(random(0,256));
}