{"id":65436,"date":"2021-09-11T14:37:11","date_gmt":"2021-09-11T18:37:11","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=65436"},"modified":"2021-09-11T14:40:17","modified_gmt":"2021-09-11T18:40:17","slug":"project-02variable-face","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/11\/project-02variable-face\/","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><div class=\"wp-block-file\"><a class=\"p5_sketch_link\" data-width=\"&ldquo;640&rdquo;\" data-height=\"&ldquo;480&rdquo;\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/09\/sketch-84.js\">cody.variable.face<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"&ldquo;640&rdquo;\" height=\"&ldquo;480&rdquo;\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">function setup() {\n    createCanvas(640, 480);\n    background(220);\n    text(\"p5.js vers 0.9.0 test.\", 10, 15);\n}\nvar faceWidth=400\nvar faceHeight=470\nvar noseCenter=300\nvar mouthAngle=0\n\nfunction draw() {\n    background(176, 196, 222);\n    ellipse((width\/2),(height\/2), 400,470);  \n    arc((width\/2),(height\/2+40),410,550,3.14,0) \/\/hair\n    arc((width\/2),(height\/2+40),400,540,3.14,0)\n    arc((width\/2),(height\/2+40),390,530,3.14,0)\n    arc((width\/2),(height\/2+40),390,520,3.14,0)   \n    arc((width\/2),(height\/2+40),390,510,3.14,0)\n    arc((width\/2),(height\/2+40),390,500,3.14,0)\n    arc((width\/2),(height\/2+40),390,490,3.14,0)\n    arc((width\/2),(height\/2+40),390,480,3.14,0)\n    arc((width\/2),(height\/2+40),390,470,3.14,0)\n    arc((width\/2),(height\/2+40),390,460,3.14,0)\n    arc((width\/2),(height\/2+40),390,450,3.14,0)\n    arc((width\/2),(height\/2+40),390,440,3.14,0) \/\/hair line\n    ellipse(225,220,80,45) \/\/orbit left\n    fill(0)\n    ellipse((faceWidth\/2+15),220,37,37) \/\/eyeball left\n    fill(255)\n    ellipse(375,220,80,45) \/\/orbit right\n    fill(0)\n    ellipse((faceWidth\/2+170),220,37,37) \/\/eyeball right\n    fill(255,182,193)\n    arc((width\/2-10),380, 150, 100, (mouthAngle-0.5), (2.5+mouthAngle)) \/\/mouth\n    fill(255,192,203)\n    triangle(300, 280, (noseCenter), 350, 320, (noseCenter+60)) \/\/nose\n    fill(255)\n    stroke(72,209,204)\n    strokeWeight(6)\n    arc(225, 185, 80, 40, 3.2, -0.04) \/\/eyebrow left\n    arc(375,185, 80, 40, 3.2, -0.04) \/\/eyebrow right\n    arc(130, 280, 50, 60, 1.5, 4.75) \/\/ear left\n    arc(500, 280, 50, 60, 4.75, 1.65) \/\/ear left\n    \n}\n\nfunction mousePressed(){\n    faceWidth=random(360,440)\n    noseCenter=random (250,300)\n    mouthAngle = random(0,1)\n}\nnoLoop();<\/code><\/pre><\/div>\n\n\n\n<p>The part I like the most is how the eyeballs change randomly.<\/p>\n\n\n\n<p><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>cody.variable.face function setup() { createCanvas(640, 480); background(220); text(&#8220;p5.js vers 0.9.0 test.&#8221;, 10, 15); } var faceWidth=400 var faceHeight=470 var noseCenter=300 var mouthAngle=0 function draw() { background(176, 196, 222); ellipse((width\/2),(height\/2), 400,470); arc((width\/2),(height\/2+40),410,550,3.14,0) \/\/hair arc((width\/2),(height\/2+40),400,540,3.14,0) arc((width\/2),(height\/2+40),390,530,3.14,0) arc((width\/2),(height\/2+40),390,520,3.14,0) arc((width\/2),(height\/2+40),390,510,3.14,0) arc((width\/2),(height\/2+40),390,500,3.14,0) arc((width\/2),(height\/2+40),390,490,3.14,0) arc((width\/2),(height\/2+40),390,480,3.14,0) arc((width\/2),(height\/2+40),390,470,3.14,0) arc((width\/2),(height\/2+40),390,460,3.14,0) arc((width\/2),(height\/2+40),390,450,3.14,0) arc((width\/2),(height\/2+40),390,440,3.14,0) \/\/hair line ellipse(225,220,80,45) \/\/orbit left fill(0) ellipse((faceWidth\/2+15),220,37,37) \/\/eyeball left fill(255) ellipse(375,220,80,45) \/\/orbit &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/11\/project-02variable-face\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project-02:Variable Face&#8221;<\/span><\/a><\/p>\n","protected":false},"author":667,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97,55],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65436"}],"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\/667"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=65436"}],"version-history":[{"count":14,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65436\/revisions"}],"predecessor-version":[{"id":65459,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65436\/revisions\/65459"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=65436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=65436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=65436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}