{"id":65225,"date":"2021-09-07T19:35:25","date_gmt":"2021-09-07T23:35:25","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=65225"},"modified":"2021-09-07T19:35:25","modified_gmt":"2021-09-07T23:35:25","slug":"project-1-my-self-portrait-24","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/07\/project-1-my-self-portrait-24\/","title":{"rendered":"Project 1: My Self Portrait"},"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=\"400\" data-height=\"600\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/09\/sketch-59.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=\"400\" height=\"600\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">function setup() {\n    createCanvas(400, 600);\n  }\n  \nfunction draw() {\n    \n    background(54, 47, 117);\n    \n    \/\/ print(mouseX, mouseY);\n    \n    \/\/ hair\n    beginShape();\n    \n    strokeWeight(2);\n    stroke(0)\n    fill(0);\n    curveVertex(40, 600);\n    curveVertex(40, 600);\n    curveVertex(63, 358);\n    curveVertex(108, 255);\n    curveVertex(198, 216);\n    curveVertex(288, 255);\n    curveVertex(334, 358);\n    curveVertex(360, 600);\n    curveVertex(360, 600);\n    \n    endShape();\n    \n    \n    \n    \/\/ shoulder and neck\n    beginShape();\n    \n    strokeWeight(2);\n    stroke(0)\n    fill(253, 236, 231);\n    curveVertex(92, 600);\n    curveVertex(92, 600);\n    curveVertex(114, 555);\n    curveVertex(147, 534);\n    curveVertex(173, 521);\n    curveVertex(184, 490);\n    curveVertex(216, 490);\n    curveVertex(227, 521);\n    curveVertex(253, 534);\n    curveVertex(286, 555);\n    curveVertex(308, 600);\n    curveVertex(308, 600);\n    \n    endShape();\n    \n    \n    \n    \/\/ face\n    beginShape();\n    \n    strokeWeight(4);\n    stroke(0)\n    curveVertex(199, 500);\n    curveVertex(199, 500);\n    curveVertex(135, 466);\n    curveVertex(120, 369);\n    curveVertex(159, 334);\n    curveVertex(198, 300);\n    curveVertex(218, 334);\n    curveVertex(280, 369);\n    curveVertex(265, 466);\n    \n    curveVertex(199, 500);\n    curveVertex(199, 500);\n    \n    endShape();\n    \n    \n    \n    \/\/ clothes\n    beginShape();\n    \n    fill(253, 151, 156);\n    curveVertex(92, 600);\n    curveVertex(92, 600);\n    curveVertex(114, 555);\n    curveVertex(147, 534);\n    curveVertex(173, 521);\n    curveVertex(201, 546);\n    curveVertex(227, 521);\n    curveVertex(253, 534);\n    curveVertex(286, 555);\n    curveVertex(308, 600);\n    curveVertex(308, 600);\n    \n    endShape();\n    \n    \n    \n    \/\/ eyes\n    fill(0);\n    circle(160, 400, 26);\n    circle(240, 400, 26);\n    \n    \n    \n    \/\/ eyelids\n    strokeWeight(8);\n    noFill();\n    arc(160, 393, 34, 16, PI + PI\/24, - PI\/6);\n    arc(240, 393, 34, 16, PI + PI\/6, - PI\/24);\n    \n    \n    \n    \/\/ eyebrows\n    arc(160, 380, 52, 20, PI + PI\/16, - PI\/6);\n    arc(240, 380, 52, 20, PI + PI\/6, - PI\/16);\n    \n    \n    \n    \/\/ mouth\n    strokeWeight(8);\n    stroke(0)\n    line(192, 450, 210, 450);\n    \n    \n    \n    \/\/ nose\n    arc(201, 430, 14, 8, PI + PI \/ 10, TWO_PI - PI \/ 10);\n    \n    \n    \n    \/\/ stars\n    noStroke();\n    fill(251, 255, 5);\n    \n    triangle(112, 54, 120, 24, 128, 54);\n    triangle(112, 56, 120, 86, 128, 56);\n    triangle(90, 56, 120, 48, 120, 64);\n    triangle(120, 48, 120, 64, 150, 56);\n    \n    triangle(312, 154, 320, 124, 328, 154);\n    triangle(312, 156, 320, 186, 328, 156);\n    triangle(290, 156, 320, 148, 320, 164);\n    triangle(320, 148, 320, 164, 350, 156);\n    \n    circle(50, 80, 8);\n    circle(170, 150, 16);\n    circle(230, 50, 12);\n    circle(360, 100, 12);\n    \n    \n    \n    \/* when mouse is on canvas, \n    the circle stars will start blinking, \n    and the character will open her mouth *\/\n    \n    if ((mouseX &gt; 0) & (mouseX < width) &&\n        (mouseY > 0) && (mouseY < height)) {\n      \n      \/\/ add rings for blinking effect\n      let starR1 = random(8, 16);\n      let starR2 = random(16, 24);\n      let starR3 = random(12, 18);\n      noFill();\n      strokeWeight(1);\n      stroke(251, 255, 5)\n      circle(50, 80, starR1);\n      circle(170, 150, starR2);\n      circle(230, 50, starR3);\n      circle(360, 100, starR3);\n      \n      \/\/ open mouse\n      strokeWeight(6);\n      stroke(0);\n      fill(254, 97, 97);\n      arc(201, 451, 22, 30, 0, PI);\n  \n    } \n      \n    \n  }\n<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch function setup() { createCanvas(400, 600); } function draw() { background(54, 47, 117); \/\/ print(mouseX, mouseY); \/\/ hair beginShape(); strokeWeight(2); stroke(0) fill(0); curveVertex(40, 600); curveVertex(40, 600); curveVertex(63, 358); curveVertex(108, 255); curveVertex(198, 216); curveVertex(288, 255); curveVertex(334, 358); curveVertex(360, 600); curveVertex(360, 600); endShape(); \/\/ shoulder and neck beginShape(); strokeWeight(2); stroke(0) fill(253, 236, 231); curveVertex(92, 600); curveVertex(92, 600); &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/07\/project-1-my-self-portrait-24\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 1: My Self Portrait&#8221;<\/span><\/a><\/p>\n","protected":false},"author":669,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,58],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65225"}],"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\/669"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=65225"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65225\/revisions"}],"predecessor-version":[{"id":65254,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/65225\/revisions\/65254"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=65225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=65225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=65225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}