{"id":71082,"date":"2022-09-10T17:16:07","date_gmt":"2022-09-10T21:16:07","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=71082"},"modified":"2022-09-10T17:16:07","modified_gmt":"2022-09-10T21:16:07","slug":"project-02-variable-face-6","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/10\/project-02-variable-face-6\/","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=\"650\" data-height=\"650\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-156.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=\"650\" height=\"650\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\nvar eyeSize = 50;\nvar faceWidth = 300;\nvar faceHeight = 300;\nvar mouthSize=20;\nvar State= 0;\n\nfunction setup() {\n    createCanvas(640, 480);\n}\n\nfunction draw() {\n    background(180);\n    fill (255,160,122);\n    ellipse(width\/2, height\/2, faceWidth,  faceHeight);\/\/ face\n    var eyeLX = width \/ 2 - faceWidth * 0.25;\/\/ x position of left eye\n    var eyeRX = width \/ 2 + faceWidth * 0.25;\/\/ x position of right eye\n    fill(255,255,255);\n    ellipse(eyeLX, height \/ 2, eyeSize, eyeSize);\/\/left eye\n    ellipse(eyeRX, height \/ 2, eyeSize, eyeSize);\/\/right eye\n    fill(0,0,0);\n    ellipse(eyeLX, height \/ 2, eyeSize\/3, eyeSize\/3);\/\/left pupil\n    ellipse(eyeRX, height \/ 2, eyeSize\/3, eyeSize\/3);\/\/right pupil\n    fill(255,0,0);\n    var mouthX =width\/2;\n    var mouthY =height\/2+0.25*faceHeight;\n    ellipse(mouthX, mouthY, mouthSize, mouthSize);\/\/mouth\n    fill(139,69,19);\n}\n\nfunction mousePressed() {\nState= int(random(1,4))\n   if (State == 1) {\nfaceWidth= 200;\nfaceHeight= 400;\neyeSize= 70;\nmouthSize=40;\nmouthY=height\/2+0.5*faceHeight;\/\/ surprise face\n} else if (State == 2) {\nfaceWidth= 325;\nfaceHeight= 275;\neyeSize=30\nmouthSize=10;\/\/relaxed face \n} else {\nfaceWidth= 300;\nfaceHeight= 300;\neyeSize=50;\nmouthSize=20\/\/ normal face\n}\n}<\/code><\/pre><\/div>\n\n\n\n<p>When I was designing the project, I was thinking about different states of facial expression and trying to show them in the product.<\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch var eyeSize = 50; var faceWidth = 300; var faceHeight = 300; var mouthSize=20; var State= 0; function setup() { createCanvas(640, 480); } function draw() { background(180); fill (255,160,122); ellipse(width\/2, height\/2, faceWidth, faceHeight);\/\/ face var eyeLX = width \/ 2 &#8211; faceWidth * 0.25;\/\/ x position of left eye var eyeRX = width \/ &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/10\/project-02-variable-face-6\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project-02-Variable-Face&#8221;<\/span><\/a><\/p>\n","protected":false},"author":709,"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\/71082"}],"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\/709"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=71082"}],"version-history":[{"count":9,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71082\/revisions"}],"predecessor-version":[{"id":71098,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71082\/revisions\/71098"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=71082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=71082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=71082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}