Skip to content

Instantly share code, notes, and snippets.

@mrzachxu
Created October 16, 2018 03:30
Show Gist options
  • Save mrzachxu/6095b6dfc366b78787dc503f37e69052 to your computer and use it in GitHub Desktop.
Save mrzachxu/6095b6dfc366b78787dc503f37e69052 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, squirrelmouth, bracesmouth, sadmouth, ehmouth];
let eyesFunctions = [normaleyes, rollingeyes, lookingrighteyes, sleepingeyes];
let addonsFunctions = [crying,hat,babyhair,sunglasses];
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 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(){
fill(0,0,0)
rect(68,110,60,20)
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)
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 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(85,77,15,15);
ellipse(120,77,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(255,255,255)
fill(96,35,35)
rect(49,50,100,10)
rect(64,20,70,30)}
function babyhair(){
noFill();
stroke(255,255,255);
bezier(80, 32, 141, 52, 93, 0, 98, 52);}
function sunglasses(){
stroke(255,255,255)
fill(0,0,0)
rect(101,80,40,15)
rect(55,80,40,15)
stroke(0,0,0)
line(95,90,100,90)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment