{"id":65397,"date":"2021-09-10T19:45:00","date_gmt":"2021-09-10T23:45:00","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=65397"},"modified":"2021-09-10T19:45:00","modified_gmt":"2021-09-10T23:45:00","slug":"lmattson-02-project","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/10\/lmattson-02-project\/","title":{"rendered":"lmattson-02-project"},"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><a class=\"p5_sketch_link\" data-width=\"600\" data-height=\"480\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/09\/lmattson-02-project.js\">lmattson-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=\"600\" height=\"480\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Luke Mattson\n\/\/section A\n\nvar w= 600\nvar h= 480\nvar headradius= w\/3\nvar eyeRadius= headradius\/4\nvar smileSize=.5\nvar skinR=255\nvar skinG=255\nvar skinB=255\nvar skin=1\n\n\n\nfunction setup() {\n    createCanvas(w, h);\n\n}\n\n\n\nfunction draw() {\n\n    background(128,206,225);    \/\/ background\n    fill(167,199,231);\n    strokeWeight(1);\n    stroke(140,170,220);\n    triangle(0,0,600,600,0,600);\n\n    \/\/hair based on size of face\n    stroke(0);                \n    fill(223,180,130);      \n    ellipse(w\/2,h\/2-50,headradius,headradius*1.4);\n\n\n    \/\/ears attached to face with 3 color possibilities\n    if (skin==1) {\n        fill(255,219,172)\n    } else if (skin==2) {\n        fill(224,172,105)\n    } else {\n        fill(241,194,125)\n    }        \n    ellipse(w\/2-headradius\/2,230,30,60);\n    ellipse(w\/2+headradius\/2,230,30,60);\n\n\n   \/\/random size face with 3 color possibilities\n   if (skin==1) {\n       fill(255,219,172)\n   } else if (skin==2) {\n       fill(224,172,105)\n   } else {\n       fill(241,194,125)\n   }\n    ellipse(w\/2,h\/2,headradius,headradius*1.4);\n\n    \n    \/\/random size eyes\n    fill(245,245,245);          \n    stroke(0);\n    strokeWeight(1.5);\n    circle(w\/2-headradius\/5,h\/2-headradius\/5,eyeRadius)\n    circle(w\/2+headradius\/5,h\/2-headradius\/5,eyeRadius)\n    fill(0,0,200,30);\n    circle(w\/2-headradius\/5,h\/2-headradius\/5,eyeRadius\/3)\n    circle(w\/2+headradius\/5,h\/2-headradius\/5,eyeRadius\/3)\n\n\n    \/\/random size mouth\n    stroke(249,21,21)\n    strokeWeight(1)\n    fill(255,127,127) \n    arc(w\/2,headradius\/5+h\/2,150,80, smileSize, PI, OPEN)\n\n    \/\/nose\n    stroke(0)\n    strokeWeight(.5)\n    line(300,240,290,275);      \n    line(310, 280,290, 275);\n    \/\/body attached to bottom of face\n    var bodyx = w\/2     \n    var bodyy = h\/2 + .5*(headradius*1.4)\n    stroke(255,255,255);        \n    strokeWeight(1.5)\n    line(bodyx,bodyy, bodyx, bodyy+40);\n    line(bodyx,bodyy+40,bodyx+10,bodyy+50)\n    line(bodyx,bodyy+40,bodyx-10,bodyy+50);\n    line(bodyx,bodyy+20,bodyx+10,bodyy+10)\n    line(bodyx,bodyy+20,bodyx-10,bodyy+10)\n   \n}\n\n    \/\/assign random variables\nfunction mousePressed() {       \n    headradius= random(.4,.7)*h\n    eyeRadius= random(headradius\/8,headradius\/4)\n    skin = int(random(0,3))\n    smileSize=random(0,1)\n       \n}\n    \n    \n\n<\/code><\/pre><\/div>\n\n\n\n<p><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":659,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97,55,1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65397"}],"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\/659"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=65397"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65397\/revisions"}],"predecessor-version":[{"id":65400,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65397\/revisions\/65400"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=65397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=65397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=65397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}