{"id":66514,"date":"2021-09-25T23:48:13","date_gmt":"2021-09-26T03:48:13","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=66514"},"modified":"2021-09-25T23:48:13","modified_gmt":"2021-09-26T03:48:13","slug":"project-04-string-art-8","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/25\/project-04-string-art-8\/","title":{"rendered":"Project-04: String Art"},"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=\"320\" data-height=\"240\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/09\/sketch-181.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=\"320\" height=\"240\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/i made mine a smile lol\nvar dx1;\nvar dy1;\nvar dx2;\nvar dy2;\nvar dy3;\nvar dy4;\nvar numLines = 50;\n\nvar x = 0;\nvar y = 0;\n\nfunction setup() {\n    createCanvas(400, 300);\n    background(244, 195, 195); \/\/baby pink color\n\n    line(50, 50, 150, 300); \/\/start line\n    line(300, 300, 350, 100); \/\/end line\n    dx1 = (150-50)\/numLines;\n    dy1 = (300-50)\/numLines;\n    dx2 = (350-300)\/numLines;\n    dy2 = (100-300)\/numLines;\n\n    line(50, 50, 150, 300); \/\/start line\n    line(300, 300, 350, 100); \/\/end line\n    dx3 = (150-50)\/numLines;\n    dy3 = (300-50)\/numLines;\n    dx4 = (350-300)\/numLines;\n    dy4 = (100-300)\/numLines;\n\n\n}\n\nfunction draw() {\n    fill(0,0,0);\n    ellipse(300, 100, 10,10);\n    ellipse(220, 100, 10,10);\n\n    \/\/lines going across canvas-parallel look\n    for (var i = 0; i &lt;=400; i +=20) {\n        stroke(53,81,95); \/\/ grey blue color\n        line(width - i, y, x, y + i*4);\n        line(i, height, width, height - i*4);\n        line(width - i, height, x, height - i*4);\n        line(i, y, width, y + i*4);\n\n    }\n\n     \/\/circle on outside\n    for (var i = 0; i &lt;=400; i +=20) {\n        stroke(255,255,255); \/\/white\n        line(width - i, y, width, height - i);\n        line(i, height, x, y + i);\n        line(width - i, height, width, y + i);\n        line(i, y, x, height - i);\n\n    }\n    \/\/ function given from instructions \n    var x1 = 0;\n    var y1 = 0;\n    var x2 = 350;\n    var y2 = 350;\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(255,0,0); \/\/red\n        line(x1, y1, x2, y2);\n        x1 += dx1;\n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    \n    }\n    noLoop();\n    var x3 = 350;\n    var y3 = 350;\n    var x4 = 0;\n    var y4 = 0;\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        fill (255,0,0); \/\/red\n        line(x1, y1, x2, y2);\n        x1 += dx1;\n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<p><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":664,"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\/66514"}],"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\/664"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=66514"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/66514\/revisions"}],"predecessor-version":[{"id":66523,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/66514\/revisions\/66523"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=66514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=66514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=66514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}