{"id":65680,"date":"2021-09-11T22:59:37","date_gmt":"2021-09-12T02:59:37","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=65680"},"modified":"2021-09-11T23:00:13","modified_gmt":"2021-09-12T03:00:13","slug":"project-2-variable-faces-12","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/11\/project-2-variable-faces-12\/","title":{"rendered":"Project 2: 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><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-105.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\">var eyeSize = 50\nvar mouthType = 1\nvar eyebrowType = 1\n\nfunction setup() {\n    createCanvas(480, 640);\n}\n\nfunction draw() {\n    background(215, 167, 119);\n    strokeWeight(0);\n    fill(107, 70, 27); \/\/ eyes\n    ellipse(width\/3, height\/3, eyeSize);\n    ellipse(width*2\/3, height\/3, eyeSize);\n    if (eyebrowType &gt;=1) { \/\/ angry eyebrows\n        fill(107, 70, 27);\n        triangle(width\/5, height\/5, width\/4, height\/4, width\/2, height\/4);\n        triangle(4*width\/5, height\/5, 3*width\/4, height\/4, width\/2, height\/4);\n    } else if (eyebrowType &lt; 1 & eyebrowType > .5) { \/\/ unibrow\n        strokeWeight(20);\n        line(width\/4, height\/5, 3*width\/4, height\/5);\n    } else { \/\/ arc eyebrows\n        noFill();\n        strokeWeight(7);\n        arc(width\/3, height\/4, 200, 100, -5\/6 * PI, -PI\/6);\n        arc(2*width\/3, height\/4, 200, 100, -5\/6 * PI, -PI\/6);\n    }\n    noFill(); \/\/ nose\n    strokeWeight(7);\n    stroke(107, 70, 27);\n    arc(width\/2, height\/2, 80, 80, PI\/4, 3\/4 * PI);\n    stroke(107, 70, 27); \/\/ line mouth\n    if (mouthType &gt;= 1) {\n        strokeWeight(7);\n        line(width\/3, 3*height\/4, 2*width\/3, 3*height\/4);\n    } else if (mouthType &lt; 1 & mouthType > .5) { \/\/ open mouth\n        strokeWeight(0);\n        fill(107, 70, 27);\n        ellipse(width\/2, 3*height\/4, width\/2, height\/10);\n    } else { \/\/ smile mouth\n        strokeWeight(7);\n        arc(width\/2, 3*height\/4, 200, 100, PI\/6, 5\/6 * PI);\n    }\n\n\n}\n\nfunction mousePressed() {\n    eyeSize = random(25, 75);\n    mouthType = random(1.5);\n    eyebrowType = random(1.5);\n\n}<\/code><\/pre><\/p>\n\n\n\n<p>I wanted to see what combination of facial features the computer would create, rather than creating combinations myself. While this prevented me from focusing on individual emotions, it&rsquo;s been fun to see what the computer comes up with. <\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch var eyeSize = 50 var mouthType = 1 var eyebrowType = 1 function setup() { createCanvas(480, 640); } function draw() { background(215, 167, 119); strokeWeight(0); fill(107, 70, 27); \/\/ eyes ellipse(width\/3, height\/3, eyeSize); ellipse(width*2\/3, height\/3, eyeSize); if (eyebrowType &gt;=1) { \/\/ angry eyebrows fill(107, 70, 27); triangle(width\/5, height\/5, width\/4, height\/4, width\/2, height\/4); triangle(4*width\/5, height\/5, &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/11\/project-2-variable-faces-12\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 2: Variable Faces&#8221;<\/span><\/a><\/p>\n","protected":false},"author":681,"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\/65680"}],"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\/681"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=65680"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65680\/revisions"}],"predecessor-version":[{"id":65688,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65680\/revisions\/65688"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=65680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=65680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=65680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}