{"id":67869,"date":"2021-10-17T00:46:05","date_gmt":"2021-10-17T04:46:05","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=67869"},"modified":"2021-10-17T00:46:05","modified_gmt":"2021-10-17T04:46:05","slug":"project-07-2","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/17\/project-07-2\/","title":{"rendered":"Project 07"},"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=\"480\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/sketch-mieep.js\">sketch-mieep<\/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=\"480\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">var nPoints = 100;\nvar x = 1;\n\nfunction setup() {\n    createCanvas(480, 480);\n    textSize(20);\n    textAlign(CENTER, CENTER)\n}\n\nfunction draw() {\n    background(0);\n    noStroke();\n\/\/draws text on screen that changes with every mouse click\n    if (x == 1) {\n        fill(255, random(200), random(200), 220);\n        text('&#25105;&#29233;&#20320;', width\/2, height\/2);\n    } else if (x == 2) {\n        fill(255, random(200), random(200), 220);\n        text('i love you', width\/2, height\/2);\n    } else if (x == 3) {\n        fill(255, random(200), random(200), 220);\n        text('te amo', width\/2, height\/2);\n    } else if (x == 4) {\n        fill(255, random(200), random(200), 220);\n        text('&#49324;&#46993;&#54644;', width\/2, height\/2);\n    } else if (x == 5) {\n        fill(255, random(200), random(200), 220);\n        text('&#24859;&#12375;&#12390;&#12427;', width\/2, height\/2);\n    } else if (x == 6) {\n        fill(255, random(200), random(200), 220);\n        text('&#9825;', width\/2, height\/2);\n    }\n\/\/the code below this line starts drawing curves\n\/\/draws first curve\/heart in top left corner\n    fill(188, 0, 56, 200);\n    drawEpitrochoidCurve();\n\/\/draws curve\/heart in top right corner\n    push();\n    translate(width, 0);\n    drawEpitrochoidCurve();\n    pop();\n\/\/draws curve\/heart in bottom left corner\n    push();\n    translate(0, height);\n    drawEpitrochoidCurve();\n    pop();\n\/\/draws curve\/heart in bottom right corner\n    push();\n    translate(480, 480);\n    drawEpitrochoidCurve();\n    pop();\n}\n\nfunction mousePressed(){\n    if (x == 1){\n        x = 2;\n    } else if (x == 2){\n        x = 3;\n    } else if (x == 3){\n        x = 4;\n    } else if (x == 4){\n        x = 5;\n    } else if (x == 5){\n        x = 6;\n    } else if (x == 6){\n        x = 1;\n    }\n}\n\nfunction drawEpitrochoidCurve() {\n\/\/ Epicycloid:\n \/\/ http:\/\/mathworld.wolfram.com\/Epicycloid.html\n    var x;\n    var y;\n    var a = map(mouseX\/3, 0, width, 0, 500);\n    var b = a \/ 8;\n    var h = constrain(mouseY \/ 8.0, 0, b);\n    \n    beginShape();\n    for (var i = 0; i &lt; nPoints; i++) {\n        var t = map(i, 0, nPoints, 0, TWO_PI);\n        x = (a + b) * cos(t) - h * cos(((a + b) \/ b) * t);\n        y = (a + b) * sin(t) - h * sin(((a + b) \/ b) * t);\n        vertex(x, y);\n    }\n    endShape();\n}<\/code><\/pre><\/p>\n\n\n\n<p><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":678,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67869"}],"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\/678"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=67869"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67869\/revisions"}],"predecessor-version":[{"id":67871,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67869\/revisions\/67871"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=67869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=67869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=67869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}