Alien generator!
I wanted to do something a little less straightforward than a human face so I decided to do alien faces, with variable star background behind as well. I also played around with how to do the mouse click function and using noLoop and loop to assign all random variables in the main program instead of assigning variables in the mousePressed function.
AlienFace
var centerX = 240;
var centerY = 320;
function setup() {
createCanvas(480, 640);
background(220);
}
function draw() {
background(0);
noStroke();
var maincolorR = random(0, 255);
var maincolorG = random(0, 255);
var maincolorB = random(0, 255);
var headWidth = random(50,460);
var headHeight = random(50, 460);
var earWidth = random(10,70);
var earHeight = random(10,70); fill(250);
var starSize = random(4,7);
for (let i = 0; i < 40; i++){
ellipse(random(0,480), random(0,640), starSize, starSize);
}
for (let i = 0; i < 60; i++){
ellipse(random(0,480), random(0,640), starSize-2, starSize-2);
} fill(maincolorR,maincolorG,maincolorB);
var widthNeck = random(30, headWidth);
rect(centerX-(widthNeck/2), centerY, widthNeck,centerY);
fill(0,0,0,50);
rect(centerX-(widthNeck/2), centerY, widthNeck,centerY); fill(maincolorR,maincolorG,maincolorB);
ellipse(centerX-(headWidth/2), centerY, earWidth, earHeight);
fill(0,0,0,50);
ellipse(centerX-(headWidth/2), centerY, earWidth, earHeight);
fill(maincolorR,maincolorG,maincolorB);
ellipse(centerX+(headWidth/2), centerY, earWidth, earHeight);
fill(0,0,0,50);
ellipse(centerX+(headWidth/2), centerY, earWidth, earHeight); fill(maincolorR,maincolorG,maincolorB);
ellipse(centerX,640,random((widthNeck+30),480),random(80,200)); triangle(centerX-(headWidth/3), centerY, centerX-(headWidth/6), centerY, centerX-(headWidth/4.5), centerY-headHeight);
fill(0,0,0,50);
triangle(centerX-(headWidth/3), centerY, centerX-(headWidth/6), centerY, centerX-(headWidth/4.5), centerY-headHeight);
fill(maincolorR,maincolorG,maincolorB);
triangle(centerX+(headWidth/3), centerY, centerX+(headWidth/6), centerY, centerX+(headWidth/4.5), centerY-headHeight);
fill(0,0,0,50);
triangle(centerX+(headWidth/3), centerY, centerX+(headWidth/6), centerY, centerX+(headWidth/4.5), centerY-headHeight); fill(maincolorR,maincolorG,maincolorB);
ellipse(centerX,centerY,headWidth,headHeight); fill(maincolorR,maincolorG,maincolorB);
ellipse(centerX, centerY+(headHeight/6), random(6,headWidth/10), random(6, headHeight/10));
fill(0,0,0,50);
ellipse(centerX, centerY+(headHeight/6), random(6,headWidth/10), random(6, headHeight/10)); fill(0,0,0);
ellipse(centerX-random(10, headWidth/3), centerY, headWidth/8, headHeight/6);
ellipse(centerX+random(10, headWidth/3), centerY, headWidth/8, headHeight/6); ellipse(centerX, centerY+(headHeight/3), random(20,headWidth/6), random(5, headHeight/9)); fill(250);
text('specimen number:',145,50);
text(round(random(0,50000)), 260, 50);
noLoop();
}
function mouseReleased() {
loop();
}