{"id":67612,"date":"2021-10-16T13:58:31","date_gmt":"2021-10-16T17:58:31","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=67612"},"modified":"2021-10-16T13:58:31","modified_gmt":"2021-10-16T17:58:31","slug":"project-7","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/16\/project-7\/","title":{"rendered":"Project 7"},"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=\"400\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/sketch-83.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=\"400\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">var nPoints = 500\nfunction setup() {\n    createCanvas(400, 400);\n    background(220);\n    text(\"p5.js vers 0.9.0 test.\", 10, 15);\n    frameRate(100)\n}\nfunction draw() {\n    \/\/background color varies with mouse X and mouse Y\n    background(map(mouseX,0,width,0,144),map(mouseY,0,width,0,122),255)\n    translate(25,25)\n\n    \/\/draw the 16 devil's curves\n    for (x = 25; x &lt; width; x += 100){\n        for (y = 25; y &lt; height; y += 100){\n            push()\n            translate(x,y)\n            drawDevilCurve()\n            pop()\n        }\n    }\n}\nfunction drawDevilCurve(){\n    \/\/Devil's Curve\n    \/\/https:\/\/mathworld.wolfram.com\/DevilsCurve.html\n\n    var x;\n    var y;\n    var a = mouseX\/15;\n    var b = constrain(mouseY\/5, 0, a*100);\n    fill(max(min(0,width),mouseX\/2),max(min(0,width),mouseY\/2),255);\n    beginShape();\n    for (var i = 0; i &lt; nPoints; i++) {\n        var t = map(i, 0, nPoints, 0, TWO_PI);\n        x = cos(t) * sqrt((sq(a) * sq(sin(t)) - sq(b) * sq(cos(t))) \/ (sq(sin(t)) - sq(cos(t))));\n        y = sin(t) * sqrt((sq(a) * sq(sin(t)) - sq(b) * sq(cos(t))) \/ (sq(sin(t)) - sq(cos(t))));\n        vertex(x, y);\n    }\n    endShape(CLOSE);\n}\n<\/code><\/pre><\/div>\n\n\n\n<p>I used Devil&rsquo;s curve because i was intrigued by its name, and the demonstration of devil&rsquo;s curve on the website is really fancy so i wanted to try it out. I made one devil&rsquo;s curve first, and played with how the mouse would affect the shape of it. After having that one devil&rsquo;s curve, i thought that i might be able to make a kaleidoscope using devil&rsquo;s curves. So I wrote an for loop, and I changed the mouse X mouseYs to make sure that there would be significant changes when we move mouse X and mouse Y no matter where the mouse is ( i&rsquo;m saying this because previously some manipulations of mouse X and mouse Y may not greatly impact the picture). <\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>I used Devil&rsquo;s curve because i was intrigued by its name, and the demonstration of devil&rsquo;s curve on the website is really fancy so i wanted to try it out. I made one devil&rsquo;s curve first, and played with how the mouse would affect the shape of it. After having that one devil&rsquo;s curve, i &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/16\/project-7\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 7&#8221;<\/span><\/a><\/p>\n","protected":false},"author":667,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[108,55],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67612"}],"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\/667"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=67612"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67612\/revisions"}],"predecessor-version":[{"id":67615,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67612\/revisions\/67615"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=67612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=67612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=67612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}