Skip to content

Instantly share code, notes, and snippets.

@mrzachxu
Created October 17, 2018 20:55
Show Gist options
  • Save mrzachxu/f150f013bcea06d21df77ff445bec84f to your computer and use it in GitHub Desktop.
Save mrzachxu/f150f013bcea06d21df77ff445bec84f to your computer and use it in GitHub Desktop.
function setup() {
createCanvas(5000,5000);
background(0,0,0);
angleMode(DEGREES);
let headFunctions = [brownhead, peachhead, yellowhead];
let mouthFunctions = [smilingmouth, vampiremouth, squirrelmouth, bracesmouth, sadmouth, ehmouth, viciousmouth];
let eyesFunctions = [normaleyes, rollingeyes, lookingrighteyes, sleepingeyes];
let addonsFunctions = [crying, hat, babyhair, sunglasses, unicornhorn, redstriphat, whitestriphat];
for (var row = 0; row <= 32; row++) {
push();
for (var col = 0; col <= 300; col++) {
let randomHead = headFunctions[int(random(0, headFunctions.length))];
randomHead();
let randomEyes = eyesFunctions[int(random(0, eyesFunctions.length))];
randomEyes();
let randomMouth = mouthFunctions[int(random(0, mouthFunctions.length))];
randomMouth();
let randomAddons = addonsFunctions[int(random(0, addonsFunctions.length))];
randomAddons();
translate(200, 0);
}
pop();
translate(0, 150);
}
}
function smilingmouth(){
stroke(255,255,255)
fill(255,255,255);
arc(100,110,70,70,0,180,PIE);}
function squirrelmouth(){
stroke(0,0,0)
line(70,113,127,113)
fill(255,255,255)
stroke(255,255,255)
rect(77,114,20,40)
rect(102,114,20,40)}
function vampiremouth(){
stroke(0,0,0)
line(70,113,127,113)
fill(255,255,255)
stroke(255,255,255)
triangle(77,115,90,115,83,160)
triangle(107,115,120,115,113,160)}
function ehmouth(){
line(70,120,127,120)}
function sadmouth(){
stroke(255,255,255)
fill(255,255,255)
arc(100,130,50,40,180,0,PIE);}
function bracesmouth(){
stroke(0,0,0)
fill(0,0,0)
rect(68,110,60,20)
stroke(255,255,255)
fill(255,255,255)
rect(68,110,10,10)
rect(78,110,10,10)
rect(88,110,10,10)
rect(98,110,10,10)
rect(108,110,10,10)
rect(118,110,10,10)
stroke(255,0,0)
fill(255,0,0)
rect(70,112,5,5)
rect(80,112,5,5)
rect(90,112,5,5)
rect(100,112,5,5)
rect(110,112,5,5)
rect(120,112,5,5)
stroke(0,0,0)
line(73,110,73,120)
line(83,110,83,120)
line(93,110,93,120)
line(103,110,103,120)
line(113,110,113,120)
line(123,110,123,120)
line(68,115,128,115)}
function viciousmouth(){
stroke(0,0,0)
fill(0,0,0)
rect(74,110,48,20)
stroke(255,255,255)
fill(255,255,255)
triangle(69,110,79,110,74,130)
rect(78,109.5,10,10)
rect(88,109.5,10,10)
rect(98,109.5,10,10)
rect(108,109.5,10,10)
triangle(118,110,128,110,123,130)}
function yellowhead(){
stroke(244,225,66)
fill(244,226,66);
ellipse(100,100,100,100);}
function brownhead(){
stroke(71,44,44)
fill(71,44,44);
ellipse(100,100,100,100);}
function peachhead(){
stroke(255,194,124)
fill(255,194,124);
ellipse(100,100,100,100);}
function normaleyes(){
fill(255,255,255);
ellipse(80,85,20,20);
ellipse(117,85,20,20);}
function rollingeyes(){
stroke(255,255,255)
fill(255,255,255)
ellipse(80,85,30,30);
ellipse(117,85,30,30);
fill(0,0,0)
fill(0,0,0);
ellipse(83,78,15,15);
ellipse(118,78,15,15);}
function lookingrighteyes(){
stroke(255,255,255)
fill(255,255,255)
ellipse(80,85,30,40);
ellipse(117,85,30,40);
stroke(0,0,0)
fill(0,0,0);
ellipse(88,83,15,15);
ellipse(125,83,15,15);}
function sleepingeyes(){
noFill();
stroke(255,255,255);
curve(120, 75, 110, 85, 130, 85, 120, 75);
curve(77, 75, 67, 85, 87, 85, 77, 75);}
function crying(){
fill(66,167,244);
stroke(66,167,244);
bezier(127, 91, 143, 165, 200, 95, 127, 91);
bezier(70, 92, 2, 102, 63, 171, 71, 91);}
function hat(){
stroke(96,35,35)
fill(96,35,35)
rect(49,50,100,10)
rect(64,20,70,30)
fill(66,63,63)
stroke(66,63,63)
rect(64,30,70,10)}
function redstriphat(){
stroke(96,35,35)
fill(96,35,35)
rect(49,50,100,10)
rect(64,20,70,30)
fill(206,78,78)
stroke(206,78,78)
rect(64,30,70,10)}
function whitestriphat(){
stroke(96,35,35)
fill(96,35,35)
rect(49,50,100,10)
rect(64,20,70,30)
fill(255,255,255)
stroke(255,255,255)
rect(64,30,70,10)}
function babyhair(){
noFill();
stroke(255,255,255);
bezier(80, 32, 141, 52, 93, 0, 98, 52);}
function sunglasses(){
stroke(0,0,0)
fill(0,0,0)
rect(101,80,40,15)
rect(55,80,40,15)
stroke(0,0,0)
line(95,90,100,90)}
function unicornhorn(){
stroke(255,86,221)
fill(255,86,221)
triangle(98,20,108,60,88,60)
stroke(255,163,236)
fill(255,163,236)
triangle(98,20,103,40,93,40)
stroke(255,255,255)
fill(255,255,255)
triangle(98,20,96,30,100,30)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment