{"id":65758,"date":"2021-09-12T19:39:02","date_gmt":"2021-09-12T23:39:02","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=65758"},"modified":"2021-09-12T19:48:52","modified_gmt":"2021-09-12T23:48:52","slug":"project-02-variable-faces-4","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/12\/project-02-variable-faces-4\/","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><p>John Henley; 15-104 section D<\/p>\n\n\n\n<p><a class=\"p5_sketch_link\" data-width=\"500\" data-height=\"500\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/09\/sketch-113.js\">sketch<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"500\" height=\"500\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/John Henley; 15-104 section D\n\nvar headWidth = 150; \/\/head variables\nvar headHeight = 160;\nvar headRound = 50;\nvar headColorRed = 141;\nvar headColorGreen = 227;\nvar headColorBlue = 204;\n\nvar hairHeight = 120 \/\/hair variables\nvar hairColorRed = 12;\nvar hairColorGreen = 8;\nvar hairColorBlue = 10;\n\nvar eyeWidth = 20; \/\/eye variables\nvar eyeGap = 25;\nvar eyeHeight = headHeight \/ 5;\n\nvar mouthWidth = 50; \/\/mouth variables\nvar mouthHeight = 40;\n\nvar backgroundValue = 150; \/\/canvas variables\n\nfunction setup() {\n    createCanvas(500, 500);\n}\n\nfunction draw() { \/\/draw initial face\n    background(backgroundValue);\n    rectMode(CENTER);\n    noStroke();\n    fill(hairColorRed, hairColorGreen, hairColorBlue);\n    rect(width \/ 2, height \/ 2 - headHeight \/ 2, headWidth + 30, hairHeight, 20, 20, 10, 10); \/\/hair\n    fill(headColorRed, headColorGreen, headColorBlue);\n    rect(width \/ 2, height \/ 2, headWidth, headHeight, headRound \/ 2, headRound \/ 2, headRound, headRound); \/\/head\n    fill(0);\n    ellipse(width \/ 2 - eyeGap, height \/ 2 - eyeHeight, eyeWidth); \/\/left eye\n    ellipse(width \/ 2 + eyeGap, height \/ 2 - eyeHeight, eyeWidth); \/\/ right eye\n    fill(255);\n    ellipse(width \/ 2 - eyeGap, height \/ 2 - eyeHeight, eyeWidth \/ 1.5); \/\/left highlight\n    ellipse(width \/ 2 + eyeGap, height \/ 2 - eyeHeight, eyeWidth \/ 1.5); \/\/ right highlight\n    stroke(0);\n    strokeWeight(5);\n    noFill();\n    arc(width \/ 2, height \/ 2 + eyeGap - 20, mouthWidth, mouthHeight, TWO_PI, PI); \/\/mouth\n\n}\n\nfunction mousePressed() {\n    \/\/randomly adjust variables\n    headWidth = random(120, 200);\n    headHeight = random(140, 230);\n    \n    headColorRed = random(128, 255);\n    headColorGreen = random(128, 255);\n    headColorBlue = random(128, 255);\n    hairHeight = random(40, 160);\n    hairColorRed = random(0, 127);\n    hairColorGreen = random(0, 127);\n    hairColorBlue = random(0, 127);\n\n    eyeWidth = random(10, 35);\n    eyeGap = random(18, 40);\n\n    mouthWidth = random(40, 60);\n    mouthHeight = random(20, 50);\n\n    backgroundValue = random(10, 245);\n}\n<\/code><\/pre><\/p>\n\n\n\n<p><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>John Henley; 15-104 section D sketch \/\/John Henley; 15-104 section D var headWidth = 150; \/\/head variables var headHeight = 160; var headRound = 50; var headColorRed = 141; var headColorGreen = 227; var headColorBlue = 204; var hairHeight = 120 \/\/hair variables var hairColorRed = 12; var hairColorGreen = 8; var hairColorBlue = 10; &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/12\/project-02-variable-faces-4\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 02: Variable Faces&#8221;<\/span><\/a><\/p>\n","protected":false},"author":650,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65758"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/users\/650"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=65758"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65758\/revisions"}],"predecessor-version":[{"id":65765,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65758\/revisions\/65765"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=65758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=65758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=65758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}