Created
October 25, 2018 15:38
-
-
Save mrzachxu/4a3c642a6d6a3e3a49921b7522acc575 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Title: Emojis | |
Imagined, Designed, and Programmed by: Zachary Xu, Zachary Xu, and Zachary Xu | |
Date: 10/23/18 | |
Description: It's a grid of emojis that are each different because they all have a unique combination of features. | |
Sources of ideas and inspiration (title, author, URL): | |
* https://cdn.cnn.com/cnnnext/dam/assets/170817095355-01-emoticons-stock-super-tease.jpg | |
* https://cmkt-image-prd.global.ssl.fastly.net/0.1.0/ps/2979467/580/386/m1/fpnw/wm0/popular-emojis-emoticons-.png?1500216910&s=434a85f93ae106a38ec27462844d40cd | |
* https://timedotcom.files.wordpress.com/2014/09/emoticon.jpg?quality=85 | |
Includes code from (title, author, URL): | |
* Ms. Brooks, https://gist.github.com/lizzybrooks/df4365b5dd8798b1c05ac87097c1c4e2 | |
* Ms. Brooks, "Canvas Transformation Worksheet," https://docs.google.com/document/d/1LBiuQ032B0tVKuFE-YKMlprGaL71TwxOZ-_3ATsJMv8/edit | |
*/ | |
function setup() { | |
createCanvas(5000,5000); | |
background(0,0,0); | |
angleMode(DEGREES); | |
let headFunctions = [brownhead, peachhead, yellowhead]; //calling on all of the functions that make heads that are defined at the bottom | |
let mouthFunctions = [smilingmouth, vampiremouth, squirrelmouth, bracesmouth, sadmouth, ehmouth, viciousmouth]; //calling on all of the functions that make mouths that are defined at the bottom | |
let eyesFunctions = [normaleyes, rollingeyes, lookingrighteyes, sleepingeyes]; //calling on all of the functions that make eyes that are defined at the bottom | |
let addonsFunctions = [crying, hat, babyhair, sunglasses, unicornhorn, redstripehat, whitestripehat]; //calling on all of the functions that make addons that are defined at the bottom | |
for (var row = 0; row <= 32; row++) { //makes 33 rows or at least until the canvas can't fit any more. | |
push(); | |
for (var col = 0; col <= 300; col++) { | |
let randomHead = headFunctions[int(random(0, headFunctions.length))]; //defining randomHead and randomizes the heads. Also calls on the heads that are in line 6 | |
randomHead(); //calling on the headFunctions because it was defined as that in the line above this code | |
let randomEyes = eyesFunctions[int(random(0, eyesFunctions.length))]; //defining randomEyes and randomizes the eyes. Also calls on the eyes that are in line 8 | |
randomEyes(); //calling on the eyesFunctions because it was defined as that in the line above this code | |
let randomMouth = mouthFunctions[int(random(0, mouthFunctions.length))]; //defining randomMouth and randomizes the mouths. Also calls on the mouths that are in line 10 | |
randomMouth(); //calling on the mouthFunctions because it was defined as that in the line above this code | |
let randomAddons = addonsFunctions[int(random(0, addonsFunctions.length))]; //defining randomAddons and randomizes the addons. Also calls on the addons that are in line 12 | |
randomAddons(); //calling on the addonsFunctions because it was defined as that in the line above this code | |
translate(200, 0);} | |
pop(); | |
translate(0, 150); | |
} | |
} | |
//all of the mouths are in this section | |
function smilingmouth(){ //produces a smiling mouth | |
stroke(255,255,255) | |
fill(255,255,255); | |
arc(100,110,70,70,0,180,PIE);} | |
function squirrelmouth(){ //produces a mouth that resembles a squirrel's | |
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(){ //produces a mouth with fangs | |
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(){ //produces a mouth that looks like the person is going "eh" | |
line(70,120,127,120)} | |
function sadmouth(){ //produces a sad mouth | |
stroke(255,255,255) | |
fill(255,255,255) | |
arc(100,130,50,40,180,0,PIE);} | |
function bracesmouth(){ //produces a mouth that has braces | |
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(){ //produces a mouth with teeth in middle but has fangs on the side | |
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)} | |
//all of the heads are in this section | |
function yellowhead(){ //makes a head that's yellow | |
stroke(244,225,66) | |
fill(244,226,66); | |
ellipse(100,100,100,100);} | |
function brownhead(){ //produces a head that's brown | |
stroke(71,44,44) | |
fill(71,44,44); | |
ellipse(100,100,100,100);} | |
function peachhead(){ //produces a head that's peach | |
stroke(255,194,124) | |
fill(255,194,124); | |
ellipse(100,100,100,100);} | |
//all of the eyes are in this section | |
function normaleyes(){ //prodcues eyes that have no pupils | |
fill(255,255,255); | |
ellipse(80,85,20,20); | |
ellipse(117,85,20,20);} | |
function rollingeyes(){ //produces eyes that resemble a person rolling his or her eyes. Eyes are looking up | |
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(){ //produces eyes that are enlarged and are also looking to the right. | |
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(){ //produces eyes that are closed | |
noFill(); | |
stroke(255,255,255); | |
curve(120, 75, 110, 85, 130, 85, 120, 75); | |
curve(77, 75, 67, 85, 87, 85, 77, 75);} | |
//all of the addons are in this section | |
function crying(){ //produces tears | |
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(){ //produces a hat with a gray line in middle | |
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 redstripehat(){ //produces a hat with a red line in middle | |
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 whitestripehat(){ //produces a hat with a white line in middle | |
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(){ //produces an image that looks like baby hair | |
noFill(); | |
stroke(255,255,255); | |
bezier(80, 32, 141, 52, 93, 0, 98, 52);} | |
function sunglasses(){ //produces an image that looks like 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(){ //produces an image that looks like a unicorn horn | |
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