{"id":74309,"date":"2022-10-12T21:24:15","date_gmt":"2022-10-13T01:24:15","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=74309"},"modified":"2022-10-13T11:54:57","modified_gmt":"2022-10-13T15:54:57","slug":"project-07","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/12\/project-07\/","title":{"rendered":"Project 07: Hallucinogenic Roses!"},"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=\"480\" data-height=\"480\" id=\"wp-block-file--media-261ce15e-d55a-4ca6-a24a-243705e3d85c\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-109.js\">sketch<\/a><a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-109.js\" class=\"wp-block-file__button\" download aria-describedby=\"wp-block-file--media-261ce15e-d55a-4ca6-a24a-243705e3d85c\">Download<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/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\">\/\/ Ilia Urgen\n\/\/ Section B\n\/\/ iurgen@andrew.cmu.edu\n\/\/ Project-07\n\nfunction setup() {\n  createCanvas(480, 480);\n}\n \nfunction draw() {\n\n    color_1 = color (189,17,89);\n    color_2 = color (253,163,26);\n\n    \/\/ ombre \n    for (var y = 0; y &lt; height; y++ ) {\n        n = map (y,0, height, 0, 1);\n        var color_3 = lerpColor (color_1, color_2, n);\n        stroke (color_3);\n        line (0, y, width, y);\n    }\n\n    noFill();\n    stroke (0);\n    strokeWeight (0.25);\n\n    \/\/ canvas border lines\n    line (1,1,1,width - 1);\n    line (1,1,width - 1,1);\n    line (1,width - 1,width - 1,width - 1);\n    line (width - 1,1,width - 1,width - 1);\n  \n    \/\/ smallest possible x-value of drawing\n    var x = min (mouseX, width);\n  \n    \/\/ link the curve scale to mouseX\n    var a0 = map (x, 0, width, 0, 50);\n    var b0 = map (mouseX, 0, width, 0, 100);\n\n    var a1 = map (x, 0, width, 0, 200);\n    var b1 = map (mouseX, 0, width, 0, 300);\n\n    var a2 = map (x, 0, width, 0, 400);\n    var b2 = map (mouseX, 0, width, 0, 800);\n\n    var a3 = map (x, 0, width, 0, 900);\n    var b3 = map (mouseX, 0, width, 0, 1800);\n\n    var a4 = map (x, 0, width, 0, 1900);\n    var b4 = map (mouseX, 0, width, 0, 3800);\n\n    var a5 = map (x, 0, width, 0, 3900);\n    var b5 = map (mouseX, 0, width, 0, 7800);\n\n    var a6 = map (x, 0, width, 0, 7900);\n    var b6 = map (mouseX, 0, width, 0, 15800);\n\n    var a7 = map (x, 0, width, 0, 15900);\n    var b7 = map (mouseX, 0, width, 0, 31800);\n  \n    \/\/ link the curve rotation to mouseY\n    var degree = map (mouseY, 0, height, 0, 360);\n  \n    push();\n    translate (width\/2, height\/2);\n  \n    for (var j = 0; j &lt; degree; j += 3600 \/ degree) {\n        \n        rotate (720 \/ degree);\n        beginShape();\n        curveVertex (0, 0);\n        \n        \/\/ draw the complete curves \n        for (var i = -10; i &lt; 10; i += 0.3) {\n            var x0 = a0 * cos (i);\n            var y0 = b0 * sin (i);\n            curveVertex (x0, y0);\n        }\n\n        for (var i = -10; i &lt; 10; i += 0.3) {\n            var x1 = a1 * cos (i);\n            var y1 = b1 * sin (i);\n            curveVertex (x1, y1);\n        }\n\n        for (var i = -10; i &lt; 10; i += 0.3) {\n            var x2 = a2 * cos (i);\n            var y2 = b2 * sin (i);\n            curveVertex (x2, y2);\n        }\n\n        for (var i = -10; i &lt; 10; i += 0.3) {\n            var x3 = a3 * cos (i);\n            var y3 = b3 * sin (i);\n            curveVertex (x3, y3);\n        }\n\n        for (var i = -10; i &lt; 10; i += 0.3) {\n            var x4 = a4 * cos (i);\n            var y4 = b4 * sin (i);\n            curveVertex (x4, y4);\n        } \n\n        for (var i = -10; i &lt; 10; i += 0.3) {\n            var x5 = a5 * cos (i);\n            var y5 = b5 * sin (i);\n            curveVertex (x5, y5);\n        }\n\n        for (var i = -10; i &lt; 10; i += 0.3) {\n            var x6 = a6 * cos (i);\n            var y6 = b6 * sin (i);\n            curveVertex (x6, y6);\n        }\n\n        for (var i = -10; i &lt; 10; i += 0.3) {\n            var x7 = a7 * cos (i);\n            var y7 = b7 * sin (i);\n            curveVertex (x7, y7);\n        }\n        \n        curveVertex (0, 0);\n        endShape();\n\n    }\n\n    pop();\n    \n    \/\/ consistent background lines\n    line (0, 0, width, height);\n    line (0, width, height, 0);\n\n    line (width\/2, 0, width\/2, height);\n    line (0, height\/2, width, height\/2)\n\n}\n<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":765,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[108,56],"tags":[33,81],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74309"}],"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\/765"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=74309"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74309\/revisions"}],"predecessor-version":[{"id":74316,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74309\/revisions\/74316"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=74309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=74309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=74309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}