{"id":71759,"date":"2022-09-12T15:30:54","date_gmt":"2022-09-12T19:30:54","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=71759"},"modified":"2022-09-12T15:30:54","modified_gmt":"2022-09-12T19:30:54","slug":"variable-faces","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/12\/variable-faces\/","title":{"rendered":"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>This project was extremely difficult for me because I kept making tiny mistakes which absolutely broke my code. This was definitely a learning experience, and towards the end I had more fun creating.<\/p>\n\n\n\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-254.js\" data-width=\"640\" data-height=\"480\">sketch<\/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\">\/\/ Kathy Lee\n\/\/Section D\n\n\/\/ Variable Setup\nvar faceHeight = 200;\nvar faceWidth = 200;\nvar shirt = 200;\nvar eye = 50;\nvar mouth = 50;\n\n\/\/ Color Variables\nvar r = 50;\nvar g = 50;\nvar b = 50;\n\n\/\/ mouthsize, hair length, eyesize\n\nfunction setup() {\n    createCanvas(640, 480);\n    text(\"Smiling Alien\", 10, 15);\n}\n\nfunction draw() {\n    background (220);\n    noStroke();\n\n    \/\/ Shirt\n    fill(200 - r, 200 - g, 200 - b);\n    ellipse((width \/ 2), (height \/ 2) + 200, shirt + 100, shirt * 1.5);\n\n    \/\/ Face\n    fill(r + 50, g + 50, b + 50);\n    ellipse(width \/ 2, (height \/ 2) + 50, faceWidth, faceHeight);\n\n    \/\/ Eyes\n    fill(r + 150, g + 150, b + 150);\n    ellipse((width \/ 2.5) + 25, height \/ 2, faceWidth - 150, eye); \/\/ left eye\n    fill(r + 150, g + 150, b + 150);\n    ellipse((width \/ 2) + 40, height \/ 2, faceWidth - 150, eye); \/\/ right eye\n    fill(\"black\");\n    ellipse((width \/ 2.5) + 20, height \/ 2, faceWidth - 200, eye - 30); \/\/ left pupil\n    fill(\"black\")\n    ellipse((width \/ 2.5) + 110, height \/ 2, faceWidth - 200, eye - 30); \/\/ right pupil\n    \n    \/\/ Mouth\n    fill(r + 175, g + 175, b + 175);\n    ellipse(width \/ 2, (height \/ 2) + 75, mouth + 50, mouth \/ 2);\n    fill(r + 50, g + 50, b + 50);\n    ellipse(width \/ 2, (height \/ 2) + 70, mouth + 50, mouth \/ 2); \/\/ top ellipse to make smiling mouth\n\n}\n\nfunction mousePressed() {\n    faceWidth = random(150, 300);\n    faceHeight = random(150, 300);\n    shirt = random(200, 300);\n    eye = random(50, 60);\n    mouth = random(50, 150);\n    r = random(0, 255);\n    g = random(0, 255);\n    b = random(0, 255);\n}\n<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>This project was extremely difficult for me because I kept making tiny mistakes which absolutely broke my code. This was definitely a learning experience, and towards the end I had more fun creating. sketch \/\/ Kathy Lee \/\/Section D \/\/ Variable Setup var faceHeight = 200; var faceWidth = 200; var shirt = 200; var &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/12\/variable-faces\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Variable Faces&#8221;<\/span><\/a><\/p>\n","protected":false},"author":736,"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\/71759"}],"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\/736"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=71759"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71759\/revisions"}],"predecessor-version":[{"id":71768,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71759\/revisions\/71768"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=71759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=71759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=71759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}