{"id":71035,"date":"2022-09-10T16:14:22","date_gmt":"2022-09-10T20:14:22","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=71035"},"modified":"2022-09-10T16:14:22","modified_gmt":"2022-09-10T20:14:22","slug":"project-02-variable-face-3","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/10\/project-02-variable-face-3\/","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><\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-e90e6469-00c8-43aa-b879-a0df865c1d53\" class=\"p5_sketch_link\" data-width=\"640\" data-height=\"600\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-150.js\">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=\"600\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">function setup() {\n    createCanvas(640, 600);\n    background(220);\n    text(\"p5.js vers 0.9.0 test.\", 10, 15);\n}\n\/\/ Simple beginning template for variable face.\nvar eyeSize = 20;\nvar faceWidth = 100;\nvar faceHeight = 300;\nvar mouthHeight = 230;\nvar noseHeight = 190;\n \nvar rface = 240;\nvar gface = 188;\nvar bface = 212;\n\nvar rmouth = 48;\nvar gmouth = 213;\nvar bmouth = 200;\n\nvar rnose = 62;\nvar gnose = 12;\nvar bnose = 94;\n\nvar reyes = 208;\nvar geyes = 255;\nvar beyes = 206;\n\nfunction setup() {\n    createCanvas(300, 300);\n}\n \nfunction draw() {\n    background(180);\n\n\n    fill (rface,gface,bface);\n    ellipse(width \/ 2, height \/ 2, faceWidth,  faceHeight);\n\n\n    var eyeLX = width \/ 2 - faceWidth * 0.25;\n    var eyeRX = width \/ 2 + faceWidth * 0.25;\n    fill (reyes,geyes,beyes);\n    ellipse(eyeLX, height \/ 2, eyeSize, eyeSize);\n    ellipse(eyeRX, height \/ 2, eyeSize, eyeSize);\n\n    fill(rmouth, gmouth, bmouth);\n    arc (width\/2, mouthHeight, 30, 10, TWO_PI, PI); \/\/mouth\n\n    fill (rnose, gnose, bnose);\n    ellipse (width\/2, noseHeight, 20); \/\/nose\n}\n \nfunction mousePressed() {\n    \/\/ when the user clicks, these variables are reassigned\n    \/\/ to random values within specified ranges. For example,\n    \/\/ 'faceWidth' gets a random value between 75 and 150.\n    faceWidth = random(75, 150);\n    faceHeight = random(200, 350);\n    eyeSize = random(10, 40);\n    mouthHeight = random(210, 240);\n    noseHeight = random (180, 200);\n    rface = random (200, 290);\n    gface = random (170, 200);\n    bface = random (200, 240);\n\n}\n<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":727,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97,121],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71035"}],"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\/727"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=71035"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71035\/revisions"}],"predecessor-version":[{"id":71039,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71035\/revisions\/71039"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=71035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=71035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=71035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}