{"id":71894,"date":"2022-09-16T11:48:04","date_gmt":"2022-09-16T15:48:04","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=71894"},"modified":"2022-09-26T15:16:50","modified_gmt":"2022-09-26T19:16:50","slug":"project-02-variable-faces-8","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/16\/project-02-variable-faces-8\/","title":{"rendered":"Project 02- Variable Faces"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><div><a class=\"p5_sketch_link\" data-width=\"640\" data-height=\"480\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-266.js\">efleischer -02 &ndash; project<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"640\" height=\"480\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/* \n    eliana fleischer\n    efleisch\n    section e\n*\/\n\n\/\/Global variables to be used across different functions\n\/\/these are all the variables that will be used to make the initial face before randomization.\n\nvar eyewidth = 20;\nvar eyeheight = 20;\nvar faceshape = 1;\nvar facewidth = 200;\nvar faceheight = 200;\nvar eyecolorR = (15);\nvar eyecolorG = (255);\nvar eyecolorB = (100);\nvar noseheight = 5;\nvar nosewidth = 5;\nvar iris = 10;\nvar skinR = 100;\nvar skinG = 100;\nvar skinB = 100;\nvar x = 320;\nvar y = 240;\n\n\nfunction setup() {\n    createCanvas(640, 480);\n    background(220);\n}\n\nfunction draw() {\n\n    background(eyecolorR, eyecolorG, eyecolorB); \/\/ sets background to the random variables for the eye color\n    \/\/faces \n    push();\n    fill(skinR,skinG, skinB);\n    noStroke()\n    if (faceshape == 1){\n\n        face1 = ellipse(x,y, facewidth, faceheight); \/\/draws ellipse face\n\n    } else {\n\n        face2 = rect(x - facewidth \/2 , y - faceheight \/2 , facewidth , faceheight); \/\/draws square face\n    }\n\n    \/\/nose\n    fill(255, 204, 255)\n    nose = ellipse(x, y, noseheight, nosewidth); \/\/draws nose at the center of the face\n    pop();\n\n    \/\/eyes\n    fill(255); \/\/white fill for irises\n    strokeWeight(2); \/\/ outline for eyes\n    Leye = arc(x - facewidth \/ 5, y - faceheight \/ 5, eyewidth, eyeheight, 0, PI + QUARTER_PI, OPEN); \/\/draws left eye\n    Reye = arc(x + facewidth \/ 5, y - faceheight \/ 5, eyewidth, eyeheight,100, PI + QUARTER_PI, OPEN); \/\/draws right eye\n\n    \/\/iris\n    fill(eyecolorR, eyecolorG, eyecolorB); \/\/ fills in the irises with the random eye color\n    Riris = ellipse(x + facewidth \/ 5, y - faceheight \/ 5, iris, iris)\n    Liris = ellipse(x - facewidth \/ 5, y - faceheight \/ 5, iris, iris);\n\n    \/\/mouth\n    strokeWeight(1);\n    mouth = line(x - facewidth \/ 5, y + faceheight \/ 5, x + facewidth \/ 5, y + faceheight \/ 5 );\n\n}\n\n\nfunction mousePressed() {\n\n    \/\/ when the user clicks, these variables are reassigned\n\n\n    facewidth = random(100, 200);\n    faceheight = random(100, 200);\n    eyewidth = random(15, 45);\n    eyeheight = random(10, 45);\n    nosewidth = random(5,15);\n    noseheight = random(5,15);\n    iris = random(1, 7);\n    eyecolorR = random(0,255);\n    eyecolorG = random(0,255);\n    eyecolorB = random(0,255);\n    faceshape = int(random(1,3));\n    skinR = random(100,200);\n    skinG = random(100,200);\n    skinB = random(100,200);\n}<\/code><\/pre><\/div>\n\n\n\n<p>The most difficult part of this project for me was figuring out a creative solution to increase variability and actually make unique and distinct images through randomization. <\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>efleischer -02 &ndash; project \/* eliana fleischer efleisch section e *\/ \/\/Global variables to be used across different functions \/\/these are all the variables that will be used to make the initial face before randomization. var eyewidth = 20; var eyeheight = 20; var faceshape = 1; var facewidth = 200; var faceheight = 200; &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/16\/project-02-variable-faces-8\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 02- Variable Faces&#8221;<\/span><\/a><\/p>\n","protected":false},"author":717,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97,121,1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71894"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/users\/717"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=71894"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71894\/revisions"}],"predecessor-version":[{"id":73144,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71894\/revisions\/73144"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=71894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=71894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=71894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}