For this project I created a “Random Minion Generator.” Rather than post my horrific sketches – I decided to include the image I saw on Pinterest that inspired the facial variations.
Click through to see all the Bobs, Kevins, and Stuarts.
//Helen Cheng
//helenc1
//Section C
var canvasX = 480/6 //canvas split into 6/6 grid
var canvasY = 640/6
var eyeType = 1
var mouthType = 3
var r = 245
var g = 224
var b = 80
var eyeOffsetY = 10
var eyeOffsetX = 0
var mouthOffsetY = 0
var hair = 5
function setup() {
createCanvas(480, 640);
}
function draw() {
background(r, g, b);
strokeWeight(5);
//goggles
fill(0);
rect(0,canvasY*2.5+eyeOffsetY, 480, canvasY);
//two eyes or one eye
if (eyeType < 3) {
//left eye
fill(255);
circle(canvasX*2, canvasY*3 + eyeOffsetY, canvasX*2);
fill(0);
circle(canvasX*2+eyeOffsetX, canvasY*3 + eyeOffsetY, canvasX);
//right eye
fill(255);
circle(canvasX*4, canvasY*3 + eyeOffsetY, canvasX*2);
fill(0);
circle(canvasX*4+eyeOffsetX, canvasY*3 + eyeOffsetY, canvasX);
}
else{
fill(255);
circle(canvasX*3, canvasY*3+eyeOffsetY, canvasX*2);
fill(0);
circle(canvasX*3+eyeOffsetX, canvasY*3+eyeOffsetY, canvasX);
}
//eyelids open or half open
if (eyeType < 2) {
fill(r,g,b);
arc(canvasX*4, canvasY*3 +eyeOffsetY, canvasX*2, canvasX*2, PI, 0);
arc(canvasX*2, canvasY*3 +eyeOffsetY, canvasX*2, canvasX*2, PI, 0);
}
else if (eyeType > 4) {
fill(r,g,b);
arc(canvasX*3, canvasY*3+eyeOffsetY, canvasX*2, canvasX*2, PI, 0);
}
//mouth
if (mouthType < 2) {
strokeWeight(5);
line(canvasX*2, mouthOffsetY+canvasY*4, canvasX*3, mouthOffsetY+canvasY*4)
}
else {
// smile
fill(0);
strokeWeight(0);
arc(canvasX*3, canvasY*4 + mouthOffsetY, canvasX*2, canvasY, 0, PI);
//teeth
fill(255);
rect(canvasX*2.7, canvasY*4+ mouthOffsetY, canvasY/5, canvasY/5);
rect(canvasX*3, canvasY*4+mouthOffsetY, canvasY/5, canvasY/5);
}
//hair
strokeWeight(hair);
line(canvasX*2,canvasY*2+eyeOffsetY,canvasX*2-abs(eyeOffsetY),canvasY+eyeOffsetY);
line(canvasX*3,canvasY*2+eyeOffsetY,canvasX*3, canvasY+eyeOffsetY);
line(canvasX*4,canvasY*2+eyeOffsetY,canvasX*4+abs(eyeOffsetY),canvasY+eyeOffsetY);
}
function mouseClicked() {
eyeType = random(5);
mouthType = random(1,3);
r = random(245,255);
g = random(224,255);
b = random(0,80);
eyeOffsetY = random(-canvasY/2,canvasY/2);
eyeOffsetX = random (-canvasX/2, canvasX/2);
mouthOffsetY = eyeOffsetY + random(canvasY/2);
hair = random(0,10)
}
Inspiration: