{"id":70824,"date":"2022-09-09T21:57:17","date_gmt":"2022-09-10T01:57:17","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=70824"},"modified":"2022-09-09T22:02:28","modified_gmt":"2022-09-10T02:02:28","slug":"project-02-variable-face-section-d","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/09\/project-02-variable-face-section-d\/","title":{"rendered":"Project-02-Variable-Face Section D"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><p>I created an alien-like girl! I enjoyed the creativity of the process and clicking my mouse to generate well-proportioned ones with a nice color pallet. <\/p>\n\n\n\n<div><a class=\"p5_sketch_link\" data-height=\"640\" data-width=\"480\" id=\"wp-block-file--media-d4575b51-c93f-4195-89f0-3008fda32b63\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-132.js\">sketch- generative art<\/a><a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-132.js\" class=\"wp-block-file__button\" download aria-describedby=\"wp-block-file--media-d4575b51-c93f-4195-89f0-3008fda32b63\">Download<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"480\" height=\"640\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/ Sandy Youssef\n\/\/ Section D\nvar eyeSizeW = 10;\nvar eyeSizeH = 10;\nvar pupilSize = 10\nvar faceWidth = 100;\nvar faceHeight = 120;\nvar skinR = 255\nvar skinG = 178\nvar skinB = 102\n\n\nfunction setup() {\n    createCanvas(480, 640);\n}\n\nfunction draw() {\n    background(180);\n    noStroke();\n    \/\/ hair\n    fill(skinR - 70, skinG - 70, skinB - 70);\n    ellipse(width\/2, height\/2, 200, 250); \n    \/\/ bow\n    fill(255);\n    ellipse(width\/2, height*0.30, 40, 40); \n    triangle(180, 155, 180, 230, 240, 196); \n    triangle(300, 155, 300, 230, 230, 196);\n    fill(skinR - 50, skinG - 50, skinB - 50);\n    \/\/ ears\n    fill(255);\n    ellipse(width* 0.38, height\/2, 30, 40); \n    ellipse(width* 0.62, height\/2, 30, 40);\n    \/\/ neck\n    fill(skinR - 40, skinG - 40, skinB - 40);\n    rect(width* 0.45, height\/2, 45, 90); \n    \/\/ face\n    fill(skinR, skinG, skinB);\n    ellipse(width \/ 2, height \/ 2, faceWidth,  faceHeight);  \n    \/\/ shirt\n    fill(255);\n    ellipse(width\/2, height* 0.75, 150, 150) \n    \/\/ eyes\n    var eyeLX = width \/ 2 - faceWidth * 0.25;\n    var eyeRX = width \/ 2 + faceWidth * 0.25;\n    fill(255);\n    ellipse(eyeLX, height \/ 2, eyeSizeW, eyeSizeH);\n    fill(255);\n    ellipse(eyeRX, height \/ 2, eyeSizeW, eyeSizeH);\n    fill(0);\n    var pupilL = width\/2 - faceWidth * 0.25;\n    var pupilR = width\/2 + faceWidth * 0.25;\n    fill(skinR - 50, skinG - 50, skinB - 50);\n    ellipse(pupilL, height\/2, pupilSize, pupilSize); \/\/ left pupil\n    ellipse(pupilR, height\/2, pupilSize, pupilSize); \/\/ right pupil\n    \/\/ nose\n    var nose1 = width\/2 - faceHeight* 0.05;\n    var nose2 = width\/2 + faceHeight * 0.05;\n    var nose3 = width\/2 - faceWidth * 0.005;\n    fill(skinR - 40, skinG - 40, skinB - 40);\n    triangle(nose1, height*0.55, nose2, height*0.55, nose3, height*0.5)\n    \/\/ mouth\n    fill(238, 131, 163); \n    arc(width\/2, height* 0.57, 40, 23, radians(0), radians(180));  \/\/ lips\n    fill(255);\n    arc(width\/2, height* 0.574, 30, 15, radians(0), radians(180)); \/\/ teeth\n}\n\n\nfunction mousePressed() {\n    \/\/ when the user clicks, these variables are reassigned\n    \/\/ to random values within specified ranges.\n    faceWidth = random(90, 180);\n    faceHeight = random(130, 180);\n    eyeSizeW = random(10,35);\n    eyeSizeH = random (10,30);\n    pupilSize = random(8, 12);\n    skinR = random(70,230);\n    skinG = random (70,230);\n    skinB = random (70,230);\n    mouth = random (1,3);\n}\n\n<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>I created an alien-like girl! I enjoyed the creativity of the process and clicking my mouse to generate well-proportioned ones with a nice color pallet. sketch- generative artDownload \/\/ Sandy Youssef \/\/ Section D var eyeSizeW = 10; var eyeSizeH = 10; var pupilSize = 10 var faceWidth = 100; var faceHeight = 120; var &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/09\/project-02-variable-face-section-d\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project-02-Variable-Face Section D&#8221;<\/span><\/a><\/p>\n","protected":false},"author":776,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97,58],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/70824"}],"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\/776"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=70824"}],"version-history":[{"count":5,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/70824\/revisions"}],"predecessor-version":[{"id":70832,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/70824\/revisions\/70832"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=70824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=70824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=70824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}