{"id":71153,"date":"2022-09-10T18:22:55","date_gmt":"2022-09-10T22:22:55","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=71153"},"modified":"2022-09-10T18:22:55","modified_gmt":"2022-09-10T22:22:55","slug":"project-02-variable-face-8","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/10\/project-02-variable-face-8\/","title":{"rendered":"Project 02: Variable Face"},"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 challenging because it took a lot of trial and error. Commenting helped a lot when going back and forth between editing different things to match them up.<\/p>\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-164.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\">\/*\n    Joan Lee\n    Section D\n\n    Aspects of variability\n        4 different expressions with mouse movement\n        switching hair color each click\n        different posture each click\n        background changes every click\n*\/\n\nvar eyeSize = 20;\nvar faceWidth = 150;\nvar faceHeight = 180;\nvar shoulderHeight = 480;\nvar bodyColor = \"white\";\nvar on = false;\nvar r = 100;\nvar g = 74;\nvar b = 65;\nvar bgColor = 0;\n\nfunction setup() {\n    createCanvas(640, 480);\n}\n\nfunction draw() {\n    background(bgColor);\n\n    \/\/hair behind face\n    if(on == true){\n        fill(r, g, b);\n    } else{\n        fill(255 - r, 255 - g, 255 - b);\n    }\n    ellipse(width \/ 2, height \/ 2 + (faceHeight \/ 4), faceWidth + 50, 330);\n\n    \/\/person\n    noStroke();\n    fill(bodyColor);\n    ellipse(width \/ 2, height, 170, shoulderHeight);    \/\/body\n    fill(250, 230, 180);\n    ellipse(width \/ 2, height \/ 2, faceWidth,  faceHeight);     \/\/head\n   \n    \/\/eyes\n    stroke(0);\n    strokeWeight(1);\n    fill(\"white\");\n    var eyeLX = width \/ 2 - faceWidth \/ 4;\n    var eyeRX = width \/ 2 + faceWidth \/ 4;\n    var x = constrain(mouseX, 20, 35);  \/\/eyes getting bigger with mouse moving right\n    circle(eyeLX, height \/ 2, x);\n    circle(eyeRX, height \/ 2, x);   \/\/whites of eyes\n    fill(63, 35, 11);\n    circle(eyeLX + 1, height \/ 2, 5);\n    circle(eyeRX - 1, height \/ 2, 5);   \/\/pupils considering interpupillary distance\n\n    \/\/nose\n    noFill();\n    stroke(205, 179, 156);  \/\/shadow\n    strokeWeight(1);\n    beginShape();\n    curveVertex(width \/ 2 + 5, height \/ 2 + 10);\n    curveVertex(width \/ 2 + 5, height \/ 2 + 10);\n    curveVertex(width \/ 2, height \/ 2 + 20);\n    curveVertex(width \/ 2 - 5, height \/ 2 + 10);\n    curveVertex(width \/ 2 - 5, height \/ 2 + 10);\n    endShape();\n    \n    \/\/mouth\n    strokeWeight(4);\n    stroke(255, 200, 200);\n    fill(0);\n    var x1 = constrain(mouseX, 1, 40);\n    ellipse(width \/ 2, height \/ 2 + 50, 60, x1);    \/\/making mouth bigger with mouse placement\n    \n    \/\/bangs\n    noStroke();\n    if(on == true){\n        fill(r, g, b);\n    } else{\n        fill(255 - r, 255 - g, 255 - b);\n    }\n    arc(width \/ 2, height \/ 2 - faceHeight \/ 6, faceWidth + 10, faceHeight - 30, PI, 0);\n\n    \/\/eyebrows\n    fill(73, 45, 35);\n    var y = constrain(mouseY, height \/ 2 - 50, height \/ 2 - 30);\n    rect((width \/ 2) - (faceWidth \/ 3), y, 30, 5);      \n    rect((width \/ 2) + (faceWidth \/ 8), y, 30, 5);  \/\/raised vs furrowed eyebrows with mouse moving up or down\n}\n\nfunction mousePressed() {\n    bgColor = random(0, 255);\n    faceWidth = random(110, 160);\n    faceHeight = random(160, 200);\n    shoulderHeight = random(330, 450);\n    if(on == true){     \/\/changing hair color each click\n        on = false;\n    } else{\n        on = true;\n    }\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>This project was challenging because it took a lot of trial and error. Commenting helped a lot when going back and forth between editing different things to match them up. sketch \/* Joan Lee Section D Aspects of variability 4 different expressions with mouse movement switching hair color each click different posture each click background &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/10\/project-02-variable-face-8\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 02: Variable Face&#8221;<\/span><\/a><\/p>\n","protected":false},"author":698,"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\/71153"}],"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\/698"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=71153"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71153\/revisions"}],"predecessor-version":[{"id":71159,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71153\/revisions\/71159"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=71153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=71153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=71153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}