{"id":65411,"date":"2021-09-11T00:31:08","date_gmt":"2021-09-11T04:31:08","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=65411"},"modified":"2021-09-11T00:31:08","modified_gmt":"2021-09-11T04:31:08","slug":"project-2-variable-faces-face-variables","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/11\/project-2-variable-faces-face-variables\/","title":{"rendered":"Project 2: Variable Faces; Face Variables."},"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-76.js\">lucacao-02-project<\/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 headwidth = 200\nvar headheight = 250\nvar eyewidth = 30\nvar eyeheight = 30\nvar pupilwidth = 30\nvar pupilheight = 30\nvar mouthwidth = 150\nvar mouthheight = 50\nvar bodywidth = 300\nvar bodyheight = 300\nvar hairhx = 0\nvar hairhy = 0\n\n\nfunction setup() {\n    createCanvas(480, 640);\n    background(171, 196, 255);\n}\n\n\nfunction draw() {\n    fill(0)\n    rect((width-bodywidth)\/2,400,bodywidth,bodyheight)\/\/blazer\n    fill(255,255,255)\n    rect((width-100)\/2,400,100,300)\/\/shirt\n\n    fill(252,210,175)\n    ellipse(width\/2,height\/2, headwidth, headheight)\/\/head\n\n    fill(248, 237, 235)\n    ellipse(width\/2-40,height\/2-20,eyewidth,eyeheight)\n    ellipse(width\/2+40,height\/2-20,eyewidth,eyeheight)\/\/eyes\n\n    fill(51, 53, 51)\n    ellipse(width\/2-40,height\/2-20,pupilwidth-20,pupilheight-20)\n    ellipse(width\/2+40,height\/2-20,pupilwidth-20,pupilheight-20)\/\/pupil\n\n    fill(239, 99, 81)\n    ellipse(width\/2,height\/2+70,mouthwidth-100,mouthheight-25)\/\/mouth\n\n    fill(70, 63, 58)\n    triangle(width\/2-30,200,hairhx+width\/2,hairhy+width\/2,width\/2,195)\n    triangle(width\/2,195,hairhx+width\/2+50,hairhy+width\/2,width\/2+45,200)\n    triangle(width\/2-10,197,hairhx+width\/2+20,hairhy+width\/2,width\/2+20,200)\/\/hair\n\n\n}\n\nfunction mousePressed() {\n    eyewidth=random(30,50)\n    eyeheight=random(30,50)\n    pupilwidth=random(30,40)\n    pupilheight=random(30,40)\n    mouthwidth=random(50,150)\n    mouthheight=random(25,50)\n    hairhx=random(20,50)\n    hairhy=random(80,100)\n}\n\n\n    \n\n\n\n\n<\/code><\/pre><\/p>\n\n\n\n<p>After declaring variables (var) in my code, locating and editing the shapes became more intuitive. However, I struggled with assigning values to my variables and understanding the relationship between each variable. Overall, I feel like adding variables helped my coding process a lot, but I still need more practice to become more efficient.  <\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>lucacao-02-project var headwidth = 200 var headheight = 250 var eyewidth = 30 var eyeheight = 30 var pupilwidth = 30 var pupilheight = 30 var mouthwidth = 150 var mouthheight = 50 var bodywidth = 300 var bodyheight = 300 var hairhx = 0 var hairhy = 0 function setup() { createCanvas(480, 640); background(171, &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/11\/project-2-variable-faces-face-variables\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 2: Variable Faces; Face Variables.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":642,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97,58,1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65411"}],"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\/642"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=65411"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65411\/revisions"}],"predecessor-version":[{"id":65416,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65411\/revisions\/65416"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=65411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=65411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=65411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}