{"id":65582,"date":"2021-09-11T19:55:30","date_gmt":"2021-09-11T23:55:30","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=65582"},"modified":"2021-09-11T20:03:59","modified_gmt":"2021-09-12T00:03:59","slug":"variable-faces-02","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/11\/variable-faces-02\/","title":{"rendered":"Variable Faces 02"},"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>It was a lot of fun deciding what to change and what style to approach this project with. It was little challenging finding the right places to put random face features but I was able to use the sample code to infer how to make changes. <\/p>\n\n\n\n<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\/sketch-98.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=\"480\" height=\"640\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Jia Ning Liu\n\/\/jianingl@andrew.cmu.edu\n\/\/Section D\n\nvar eyeSize = 20;\nvar faceWidth = 100;\nvar faceHeight = 150;\nvar mouthLength = 30\nvar colorR = 200\nvar colorG = 200\nvar colorB = 200\nvar mouthStart = 30 \nvar mouthHeight = 30 \/\/controls the y coordinate of the mouth\nvar hairRadius = 40 \/\/controls size of hair\nvar noseLength = 30\n\nfunction setup() {\n    createCanvas(480, 640);\n}\n\nfunction draw() {\n    noFill()\n    background(204, 255, 204);\n    strokeWeight(5); \/\/increases stroke weight to give face a more graphic feel\n    fill (colorB, colorG, colorR); \/\/generated a random RGB color\n    ellipse(width \/ 2, height \/ 2 - 80, hairRadius); \/\/ creates hair of different sizes\n    fill (colorR, colorG, colorB);\n    ellipse(width \/ 2, height \/ 2, faceWidth, faceHeight);\n    var eyeLX = width \/ 2 - faceWidth * 0.25;\n    var eyeRX = width \/ 2 + faceWidth * 0.25;\n    fill (colorG, colorB, colorR);\n    ellipse(eyeLX, height \/ 2, eyeSize, eyeSize);\n    ellipse(eyeRX, height \/ 2, eyeSize, eyeSize);\n    \/\/generates a random length of line for the mouth\n    line(width \/ 2 - mouthStart, height \/ 2 + mouthHeight, width \/ 2 + mouthLength, height \/ 2 + mouthHeight); \n    fill(colorB, colorG, colorR);\n    rect(width \/ 2, height \/ 2, 5, noseLength); \/\/ generates different nose lengths\n}\n\nfunction mousePressed() {\n    faceWidth = random(75, 150);\n    faceHeight = random(100, 200);\n    eyeSize = random (10, 30)\n    mouthLength = random (20,80)\n    colorR = random(1,256)\n    colorG = random(1,256)\n    colorB = random (1,256)\n    mouthStart = random (20,80)\n    mouthHeight = random (20,50)\n    hairRadius = random (100,200)\n    noseLength = random (10,40)\n}\n<\/code><\/pre><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>It was a lot of fun deciding what to change and what style to approach this project with. It was little challenging finding the right places to put random face features but I was able to use the sample code to infer how to make changes. sketch \/\/Jia Ning Liu \/\/jianingl@andrew.cmu.edu \/\/Section D var eyeSize &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/11\/variable-faces-02\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Variable Faces 02&#8221;<\/span><\/a><\/p>\n","protected":false},"author":654,"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\/f2021\/wp-json\/wp\/v2\/posts\/65582"}],"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\/654"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=65582"}],"version-history":[{"count":5,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65582\/revisions"}],"predecessor-version":[{"id":65610,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65582\/revisions\/65610"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=65582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=65582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=65582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}