{"id":71202,"date":"2022-09-10T18:58:57","date_gmt":"2022-09-10T22:58:57","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=71202"},"modified":"2022-09-10T18:58:57","modified_gmt":"2022-09-10T22:58:57","slug":"project-02-variable-faces-2","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/10\/project-02-variable-faces-2\/","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>This is my project 02 &ldquo;Variable Faces&rdquo;. The most challenging part of this project is organizing the logic of my code. Once the logic is sorted out it was actually not too complicated. I struggled a bit with certain shapes.<\/p>\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-174.js\" data-width=\"480\" data-height=\"640\">sketch<\/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\">\/* Jenny Wang\n   Section B *\/\n\nvar eyes = 3;\nvar features = 3;\nvar mouth = 3;\nvar hair = 3;\n\nfunction setup() {\n    createCanvas(480, 640);\n}\n\nfunction draw() {\n    background(250,160,150);\n    noStroke()\n    fill(230,89,132);\n    ellipse()\n    noStroke();\n    fill(226,190,134);\n    ellipse(234,258,199,250);\/\/face\n    strokeWeight(2); \/\/nose\n    stroke(177,123,60);\n    line(231,272,220,300);\n    strokeWeight(2);\n    stroke(177,123,60);\n    line(220,300,236,302);\n\n\n    if(eyes&lt;=1){ \/\/round eyes\n        noStroke();\n        fill(255,255,255);\n        circle(182,252,46);\n        noStroke();\n        fill(162,196,231);\n        circle(182,252,29);\n        noStroke();\n        fill(43,91,137);\n        circle(182,252,17);\n        \/\/left eye\n        noStroke();\n        fill(255,255,255);\n        circle(292,252,46);\n        noStroke();\n        fill(162,196,231);\n        circle(292,252,29);\n        noStroke();\n        fill(43,91,137);\n        circle(292,252,17);\n        \/\/right eye\n    }\n    else if(eyes&lt;=2){ \/\/squint eyes\n        strokeWeight(3);\n        stroke(65,50,20)\n        line(170,253,197,265);\n        line(170,280,197,265);\/\/left eye\n        line(270,265,297,254);\n        line(297,280,270,265);\/\/right eye\n    }\n    else if (eyes&lt;=3){ \/\/half eyes\n        noStroke();\n        fill(255,255,255);\n        arc(182,252,46,46,2.6,0.5,open)\n        noStroke();\n        fill(164,209,125);\n        circle(182,252,29);\n        noStroke();\n        fill(177,123,57);\n        circle(182,252,17);\n        \/\/left eye\n        noStroke();\n        fill(255,255,255);\n        arc(292,252,46,46,2.6,0.5,open)\n        noStroke();\n        fill(164,209,125);\n        circle(292,252,29);\n        noStroke();\n        fill(177,123,57);\n        circle(292,252,17);\n    }\n\n    if(features&lt;=1){ \/\/mole\n        strokeWeight(3);\n        fill(177,123,57)\n        point(186,321);\n    }\n    else if(features&lt;=2){ \/\/freckles\n        strokeWeight(3);\n        fill(177,123,57);\n        point(162,301);\n        strokeWeight(3);\n        fill(177,123,57);\n        point(177,309);\n        strokeWeight(3);\n        fill(177,123,57);\n        point(194,303);\n        strokeWeight(3);\n        fill(177,123,57);\n        point(265,306);\n        strokeWeight(3);\n        fill(177,123,57);\n        point(283,299);\n        strokeWeight(3);\n        fill(177,123,57);\n        point(298,308);\n    }\n    else if(features&lt;=3){ \/\/blush\n        noStroke();\n        fill(239,171,199);\n        ellipse(164,306,28,16);\n        noStroke();\n        fill(239,171,199);\n        ellipse(305,306,28,16);\n    }\n\n    if(mouth&lt;=1){ \/\/happy laugh\n        noStroke();\n        fill(246,166,193);\n        arc(237,324,80,70,0,0.6 + 2.6, OPEN);\n    }\n    else if(mouth&lt;=2){\/\/sad mouth\n        strokeWeight(4);\n        stroke(246,160,193);\n        line(214,350,235,343);\n        strokeWeight(4);\n        stroke(246,160,193);\n        line(256,350,235,343);\n    }\n    else if(mouth&lt;=3){ \/\/mouth with teeth\n        noStroke();\n        fill(237,10,124);\n        arc(237,324,80,70,0,0.6 + 2.6, OPEN);\n        noStroke();\n        fill(255,255,255);\n        rect(227,323,21,11);\n    }\n\n    if(hair&lt;=1){ \/\/red hair\n        noStroke();\n        fill(199,102,29);\n        arc(233,179,160,93,2.6,0.5, OPEN);\n        noStroke();\n        fill(199,102,29);\n        circle(347,197,95);\n        noStroke();\n        fill(199,102,29);\n        circle(116,197,95);\n    }\n    else if(hair&lt;=2) { \/\/blonde hair\n        noStroke();\n        fill(231,209,100);\n        circle(234,124,98);\n        noStroke();\n        fill(231,209,100);\n        circle(305,148,84);\n        noStroke();\n        fill(231,209,100);\n        circle(342,203,58);\n        noStroke();\n        fill(231,209,100);\n        circle(347,244,45);\n        noStroke();\n        fill(231,209,100);\n        circle(160,148,84);\n        noStroke();\n        fill(231,209,100);\n        circle(127,203,58);\n        noStroke();\n        fill(231,209,100);\n        circle(121,244,45);\n    }\n    else if(hair&lt;=3){ \/\/brown hair\n        noStroke();\n        fill(177,123,57);\n        arc(233,180,232,126,2.6,0.5, OPEN);\n        noStroke();\n        fill(177,123,57);\n        rect(118,180,38,205)\n        noStroke();\n        fill(177,123,57);\n        rect(311,180,38,205);\n    }\n    \n    noStroke(); \/\/neck\n    fill(226,190,134);\n    rect(210,378,48,63);\n    noStroke(); \/\/body\n    fill(226,190,134);\n    rect(120,415,231,225,65,65,0,0);\n    noStroke(); \/\/dress\n    fill(184,191,225);\n    quad(155,527,202,415,265,415,320,527);\n    noStroke(); \n    fill(226,190,134);\n    triangle(202,415,265,415,233,475);\n    noStroke(); \n    fill(184,191,225);\n    rect(155,527,164,113);\n}\n\nfunction mousePressed() {\n    eyes = random (0,3);\n    features = random (0,3);\n    mouth = random (0,3);\n    hair = random (0,3);\n}\n    <\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>This is my project 02 &ldquo;Variable Faces&rdquo;. The most challenging part of this project is organizing the logic of my code. Once the logic is sorted out it was actually not too complicated. I struggled a bit with certain shapes. sketch \/* Jenny Wang Section B *\/ var eyes = 3; var features = 3; &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/10\/project-02-variable-faces-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 02: Variable Faces&#8221;<\/span><\/a><\/p>\n","protected":false},"author":769,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97,56],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71202"}],"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\/769"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=71202"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71202\/revisions"}],"predecessor-version":[{"id":71208,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71202\/revisions\/71208"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=71202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=71202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=71202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}