The source of all Miss Americas!
I was unable to convert it to p5.js. It would have been better to click yourself to generate a Miss America. This was put together with a lot of brute force coding, I used the random function for every variable. Some of the random numbers were randomly choosing a type of object or string to put (like the type of bangs, or the names) and the other way I used random numbers were to change the size of something (like the slight change in the shape of the eyes, or the hair length)
//cc Charlotte Stiles
//Miss America Generator
float sideFace = 0, chin = 0;
color bgColor = color(int(random(200)),int(random(200)),int(random(200)));
String [] issueOne = {"Human ", "Youth ", "Senior ", "Homeless ", "Animal ","Disease ", "Prison ","World Peace ","Global Climate Change "};
String [] issueTwo = {"Rights", "Brought to Justice", "Awareness", "Abuse Pervention", "Help","Problems","Rescue","Fund","Appreciation"};
String [] name = {"Sophia","Emma","Olivia","Stephanie","Ava","Mia","Emily","Abigail","Madison","Vanessa","Nina","Avery","Sofia",
"Chloe","Ella","Harper","Amelia","Aubrey","Addison","Evelyn","Natalie","Grace"};
int nameNum = int(random(name.length));
int i1 = int(random(1,9));
int i2 = int(random(1,9));
int bangsNum = int(random(1,4));
color hairColor;
color skinColor;
int hairColorNum = int(random(8));
int hairLength = int(random(20));
float eyeNum = random(-3,3);
float mouthNum = random(-3,3);
float ex=0,ey=0;
void setup(){
size(400,400);
ellipseMode(CENTER);
}
void draw(){
noStroke();
fill(bgColor);
rect(0, 0, width, height);
hair();
face();
hairColorFun();
skinColorFun();
eyes();
bangs();
platformIssue();
name();
mouth();
}
void face(){
fill(skinColor);
beginShape();
curveVertex(252,142);
curveVertex(158,129);
curveVertex(131,126);
curveVertex(112,150);
curveVertex(120-sideFace,223);//left cheak
curveVertex(200,279+ chin); //chin
curveVertex(280+sideFace,218 );// right cheak
curveVertex(287,155);
curveVertex(257,118);
curveVertex(130,127);
curveVertex(156,219);
endShape();
}
void hairColorFun(){
if (hairColorNum < = 5) {
hairColor = color(231,235,153) ;
}
else if (hairColorNum == 6) {
hairColor = color(80,10,2) ;
}
else if (hairColorNum == 7){
hairColor = color (200,127,33);
}
}
void skinColorFun(){
if (hairColorNum <= 5) { skinColor = color(255,218,186) ; } else if (hairLength >= 20) {
skinColor = color(138,93,33) ;
}
else if (hairLength < = 19){
skinColor = color (250,194,145);
}
}
void bangs(){
fill(hairColor);
if (bangsNum == 1) {
beginShape();
curveVertex(97,89);
curveVertex(157,82);
curveVertex(258,175);
curveVertex(313,170);
curveVertex(310,157);
curveVertex(278,96);
curveVertex(239,178);
endShape();
}
else if (bangsNum == 2) {
beginShape();
curveVertex(250,35);
curveVertex(138,71);
curveVertex(108,137);
curveVertex(290,142);
curveVertex(297,100);
curveVertex(246,74);
endShape();
}
else if (bangsNum == 3) {
beginShape();
curveVertex(239,112);
endShape();
}
}
void name(){
textSize(30);
textAlign(CENTER);
text(name[nameNum],width/2,30);
}
void hair(){
fill(hairColor);
ellipse(201,142,220,-176);
rect (94,137,216,224 - hairLength,32);
}
void eyes(){
fill(0);
beginShape();
curveVertex(ex+120,ey+249);
curveVertex(ex+127+eyeNum,ey+186);
curveVertex(ex+145,ey+177);
curveVertex(ex+159,ey+184);
curveVertex(ex+163+eyeNum,ey+192);
curveVertex(ex+137,ey+195);
endShape();
triangle(119,170,134,186,127,187);
triangle(123,162,142,187,132,184);
triangle(130,161,149,182,139,183);
triangle(277,164,264,181,268,184);
triangle(273,162,259,187,248,184);
triangle(265,161,252,182,241,183);
beginShape();
curveVertex(ex+153,ey+210);
curveVertex(ex+262-eyeNum,ey+188);
curveVertex(ex+257,ey+177);
curveVertex(ex+232,ey+184);
curveVertex(ex+233-eyeNum,ey+192);
curveVertex(ex+246,ey+195);
endShape();
}
void mouth(){
noStroke();
fill(200 + (hairColorNum*7) ,50,50);
beginShape();
curveVertex(width/2+157, height/2+10);
curveVertex(width/2+9, height/2+22);
curveVertex(width/2+-2, height/2+25);
curveVertex(width/2+-19, height/2+23);
curveVertex(width/2-47, height/2+37);
curveVertex(width/2+-3, height/2+(61+mouthNum));
curveVertex(width/2+39, height/2+33);
curveVertex(width/2+11, height/2+-13);
endShape();
fill(255);
beginShape();
curveVertex(width/2+207, height/2+10);
curveVertex(width/2+15, height/2+35);
curveVertex(width/2+0, height/2+37);
curveVertex(width/2+-23, height/2+36);
curveVertex(width/2-46, height/2+37);
curveVertex(width/2+0, height/2+47);
curveVertex(width/2+40, height/2+33);
curveVertex(width/2+11, height/2+37);
endShape();
}
void platformIssue(){
textSize(13);
fill(0);
text("Platform Issue: " + issueOne[i1] + issueTwo[i2],width/2,380);
//I'm putting i1 and i2 as global variables so it choses one random
//number for each time the program runs, and sticks with it
}
void mouseClicked(){
sideFace = random(-10,10);
chin=(random(-5,15));
bgColor = color(int(random(200,255)),int(random(200,255)),int(random(200,255)));
i1 = int(random(1,9));
i2 = int(random(1,9));
bangsNum = int(random(1,4));
hairColorNum = int(random(8));
hairLength = int(random(48));
eyeNum = random(-3,3);
mouthNum = random(-3,3);
nameNum = int(random(name.length));
}