{"id":65789,"date":"2021-09-12T23:45:54","date_gmt":"2021-09-13T03:45:54","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=65789"},"modified":"2021-09-12T23:45:54","modified_gmt":"2021-09-13T03:45:54","slug":"project-02-variable-faces-6","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/12\/project-02-variable-faces-6\/","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><a class=\"p5_sketch_link\" data-width=\"480\" data-height=\"640\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/09\/jen-project-02-sketch-copy.js\">jen project 02 sketch copy<br><\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/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\">\/\/Jennifer Kim\n\/\/Class section: C\n\nvar eyeSize = 40;\nvar Type = 0;\nvar eyeWidth = 28;\nvar eyeHeight = 35;\nvar faceWidth = 275;\nvar pupilWidth = 40;\nvar pupilHeight = 30;\nvar faceHeight = 250;\nvar faceColorA = 0;\nvar faceColorB = 255;\nvar faceColor = 2;\nvar hairclipStyle = 0;\n\nfunction setup() {\n    createCanvas(480, 640);\n}\n \nfunction draw() {\n    background(229,204,255);\n    \n    \/\/hair\n    fill(51,25,0);\n    arc(240, 340, 300, 380, QUARTER_PI + HALF_PI, QUARTER_PI, OPEN);\n\n    \n    \/\/face\n    if (faceColor&gt;1) {\n       fill(255,229,204);\n   } else if (faceColor&lt;=1) {\n       fill(241,200,124);\n   }\n    ellipse(width \/ 2, height \/ 2, faceWidth,  faceHeight);\n    \n    \/\/eyes \n    fill(255);\n    var eyeLX = width \/ 2 - faceWidth * 0.25;\n    var eyeRX = width \/ 2 + faceWidth * 0.25;\n    ellipse(eyeLX, height \/ 2, eyeSize, eyeSize);\n    ellipse(eyeRX, height \/ 2, eyeSize, eyeSize);\n    \n    \/\/pupils\n    fill(153,76,0);\n    ellipse(width\/2-50,height\/2,pupilWidth-15,pupilHeight-15);\n    ellipse(width\/2+50,height\/2,pupilWidth-15,pupilHeight-15);\n    \n    \/\/circle nose\n    fill(241,194,125);\n    ellipse(width\/2,height\/2+30,15,15);\n\n    \/\/straight mouth\n    if (Type &lt;= 1.25){ \n    fill(255,213,255);\n    rect(width\/2-25, height\/2+60,50,5);\n    \n    \/\/triangle nose\n    } else if (Type &lt;= 2.5){ \n    fill(241,194,125); \n    triangle(width\/2 - 15, height\/2 + 40, width\/2 + 15, height\/2 + 40, width\/2, height\/2);\n    }\n    \n    \/\/hair accessories\n    if (hairclipStyle &lt;= 0.8){ \n        fill(76,0,153);\n        circle(width\/3, height\/3, 60); \n        circle(width - (width\/3), height\/3, 60);\n        \n    } else { \/\/attempt at using curve vertex\n        fill(76,0,153);\n        beginShape(); \n        curveVertex(310, 280);\n        curveVertex(350, 300);\n        curveVertex(390, 250);\n        curveVertex(290, 210);\n        curveVertex(270, 310);\n        endShape();\n    }\n}\n \nfunction mousePressed() {\n    faceWidth = random(220, 230);\n    faceHeight = random(240, 250);\n    eyeSize = random(30, 40);\n    Type = random(0,3);\n    pupilWidth=random(30,35);\n    pupilHeight=random(30,35);\n    faceColorA = random(30, 150);\n    faceColorB = random(70,200);\n    hairclipStyle = random(0, 3);\n}<\/code><\/pre><\/p>\n\n\n\n<p>Figuring out how to shape and position with the curveVertex() was tricky, but I was eventually able to create what I was going for. It was also interesting to put my new knowledge from lecture about if\/else statements to use.<\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>jen project 02 sketch copy \/\/Jennifer Kim \/\/Class section: C var eyeSize = 40; var Type = 0; var eyeWidth = 28; var eyeHeight = 35; var faceWidth = 275; var pupilWidth = 40; var pupilHeight = 30; var faceHeight = 250; var faceColorA = 0; var faceColorB = 255; var faceColor = 2; var &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/12\/project-02-variable-faces-6\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 02: Variable Faces&#8221;<\/span><\/a><\/p>\n","protected":false},"author":651,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97,57],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65789"}],"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\/651"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=65789"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65789\/revisions"}],"predecessor-version":[{"id":65798,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65789\/revisions\/65798"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=65789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=65789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=65789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}