{"id":71704,"date":"2022-09-11T23:32:15","date_gmt":"2022-09-12T03:32:15","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=71704"},"modified":"2022-09-11T23:39:24","modified_gmt":"2022-09-12T03:39:24","slug":"project-2-4","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/11\/project-2-4\/","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 id=\"wp-block-file--media-ce1fd27c-97bb-40d3-8d69-f06e1a90f993\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-242.js\">sketch<\/a><a class=\"p5_sketch_link\" data-width=\"640\" data-height=\"480\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-242.js\" download aria-describedby=\"wp-block-file--media-ce1fd27c-97bb-40d3-8d69-f06e1a90f993\">Download<\/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=\"480\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Sofia Rolla\n\/\/Section D\n\nvar eyeSize = 20;\nvar pupilSize= 5;\nvar faceWidth = 150;\nvar faceHeight = 200;\nvar noseWidth = 20;\nvar noseHeight = 30;\nvar mouthSize = 40;\n\nvar faceR = 199\nvar faceG = 177\nvar faceB = 140\n\nvar pupilR = 112\nvar pupilG = 166\nvar pupilB = 233\n  \nvar noseR = 200\nvar noseG = 190\nvar noseB = 170\n\nvar mouthR = 0\nvar mouthG = 0\nvar mouthB = 0\n\n\n\n\n\nfunction setup() {\n    createCanvas(640, 480);\n}\n \nfunction draw() {\n    background(170,10,90);\n    \/\/head\n    fill(faceR, faceG, faceB)\n    ellipse(width \/ 2, height \/ 2, faceWidth,  faceHeight);\n    \/\/eyes\n    fill(255)\n    var eyeLX = width \/ 2 - faceWidth * 0.25;\n    var eyeRX = width \/ 2 + faceWidth * 0.25;\n    ellipse(eyeLX, height \/ 2, eyeSize, eyeSize);\n    ellipse(eyeRX, height \/ 2, eyeSize, eyeSize);\n    \/\/pupils\n    fill(pupilR, pupilG, pupilB)\n    ellipse(eyeLX, height \/ 2, pupilSize, pupilSize);\n    ellipse(eyeRX, height \/ 2, pupilSize, pupilSize);\n    \/\/nose\n    var noseY = height \/ 2 + faceHeight* 0.15;\n    fill(noseR, noseG, noseB)\n    ellipse(width\/2, noseY, noseWidth, noseHeight); \n    \/\/mouth\n    fill(mouthR, mouthG, mouthB)\n    ellipse(width \/ 2, height \/ 2 + .4 * faceHeight, mouthSize, faceHeight\/10)\n    \/\/hair\n    arc(width \/ 2, height \/ 2-35, faceWidth+10,  faceHeight-10, PI,2*PI, PI);\n   \n \n}\n \nfunction mousePressed() {\n    faceWidth = random(75, 150);\n    faceHeight = random(100, 200);\n    eyeSize = random(20, 40);\n    pupilSize = random(5,15);\n    noseWidth = random(5,20)\n    noseHeight= random (10,30);\n    mouthX = random (20, 50);\n    faceR = random (170,230)\n    faceG = random (50,200)\n    faceB = random (50,200)\n    mouthR = random (50,200)\n    mouthB = random (50,200)\n    mouthG = random (50,200)\n    pupilR = random (50,200)\n    pupilG = random (50,200)\n    pupilB = random (50,200)\n    noseR = random (50,200)\n    noseG = random (50,200)\n    noseB = random (50,200)\n    \n}<\/code><\/pre><\/div>\n\n\n\n<p>This was a difficult process for me. I struggled with finding the right variables and with setting proper variables for positions of certain facial features. I hope that this process will get easier as I keep learning.<\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>This was a difficult process for me. I struggled with finding the right variables and with setting proper variables for positions of certain facial features. I hope that this process will get easier as I keep learning.<\/p>\n","protected":false},"author":755,"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\/f2022\/wp-json\/wp\/v2\/posts\/71704"}],"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\/755"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=71704"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71704\/revisions"}],"predecessor-version":[{"id":71719,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71704\/revisions\/71719"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=71704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=71704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=71704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}