{"id":72656,"date":"2022-09-24T12:28:39","date_gmt":"2022-09-24T16:28:39","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=72656"},"modified":"2022-09-24T12:28:39","modified_gmt":"2022-09-24T16:28:39","slug":"project-04-string-art-2","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/24\/project-04-string-art-2\/","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><a class=\"p5_sketch_link\" data-height=\"300\" data-width=\"400\" id=\"wp-block-file--media-f119291a-1b62-4c70-923e-c792d27d4ef3\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-333.js\">string art<\/a><a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-333.js\" class=\"wp-block-file__button\" download aria-describedby=\"wp-block-file--media-f119291a-1b62-4c70-923e-c792d27d4ef3\">Download<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"400\" height=\"300\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/ Sandy Youssef, syoussef\n\/\/Section D\nvar dx1;\nvar dy1;\nvar dx2;\nvar dy2;\nvar numLines = 50;\nvar numLine = 30;\n\nfunction setup() {\n    createCanvas(400, 300);\n    background(0);\n   \n   \n}\n\nfunction draw() {\n    stroke(\"yellow\");  \/\/ yellow lines 1\n    line(0, 300, 50, 0);\n    line(0, 0, 150, 150);\n    dx1 = (50-0)\/numLines; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (0-300)\/numLines;\n    dx2 = (150-0)\/numLines;\n    dy2 = (150-0)\/numLines;\n    var x1 = 0; \/\/ x1 of line 1\n    var y1 = 300; \/\/y1 of line 1\n    var x2 = 0;  \/\/x1 of line 2\n    var y2 = 0; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(\"yellow\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n\n    stroke(\"green\");  \/\/ green lines 1\n    line(0, 0, 5, 300);\n    line(50, 300, 190, 300);\n    dx1 = (5-0)\/numLines; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (300-0)\/numLines;\n    dx2 = (190-50)\/numLines;\n    dy2 = (300-300)\/numLines;\n    var x1 = 0; \/\/ x1 of line 1\n    var y1 = 0; \/\/y1 of line 1\n    var x2 = 50;  \/\/x1 of line 2\n    var y2 = 300; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(\"green\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n    stroke(\"yellow\");  \/\/yellow lines 2\n    line(400, 200, 50, 0);\n    line(0, 300, 300, 300);\n    dx1 = (50-400)\/numLines; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (0-200)\/numLines;\n    dx2 = (300-0)\/numLines;\n    dy2 = (300-300)\/numLines;\n    var x1 = 400; \/\/ x1 of line 1\n    var y1 = 200; \/\/y1 of line 1\n    var x2 = 0;  \/\/x1 of line 2\n    var y2 = 300; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(\"yellow\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n    stroke(\"yellow\");  \/\/yellow lines 3\n    line(400, 200, 250, 0);\n    line(0, 300, 300, 300);\n    dx1 = (250-400)\/numLines; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (0-200)\/numLines;\n    dx2 = (300-0)\/numLines;\n    dy2 = (300-300)\/numLines;\n    var x1 = 400; \/\/ x1 of line 1\n    var y1 = 200; \/\/y1 of line 1\n    var x2 = 0;  \/\/x1 of line 2\n    var y2 = 300; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(\"yellow\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n    stroke(\"yellow\");  \/\/yellow lines 4\n    line(400, 200, 150, 0);\n    line(0, 300, 300, 300);\n    dx1 = (150-400)\/numLines; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (0-200)\/numLines;\n    dx2 = (300-0)\/numLines;\n    dy2 = (300-300)\/numLines;\n    var x1 = 400; \/\/ x1 of line 1\n    var y1 = 200; \/\/y1 of line 1\n    var x2 = 0;  \/\/x1 of line 2\n    var y2 = 300; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(\"yellow\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n    stroke(\"green\");  \/\/green lines 2\n    line(400, 200, 400, 0);\n    line(0, 300, 300, 300);\n    dx1 = (400-400)\/numLines; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (0-200)\/numLines;\n    dx2 = (300-0)\/numLines;\n    dy2 = (300-300)\/numLines;\n    var x1 = 400; \/\/ x1 of line 1\n    var y1 = 200; \/\/y1 of line 1\n    var x2 = 0;  \/\/x1 of line 2\n    var y2 = 300; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(\"green\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n\n   \n    stroke(\"green\");  \/\/ green lines 3\n    line(450, 0, 0, 0);\n    line(0, 150, 300, 300);\n    dx1 = (0-450)\/numLine; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (0-0)\/numLine;\n    dx2 = (300-0)\/numLine;\n    dy2 = (300-150)\/numLine;\n    var x1 = 450; \/\/ x1 of line 1\n    var y1 = 0; \/\/y1 of line 1\n    var x2 = 0;  \/\/x1 of line 2\n    var y2 = 150; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLine; i += 1) {\n        stroke(\"green\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n    stroke(\"green\");  \/\/ green lines 4\n    line(300, 0, 0, 0);\n    line(0, 150, 300, 300);\n    dx1 = (0-300)\/numLine; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (0-0)\/numLine;\n    dx2 = (300-0)\/numLine;\n    dy2 = (300-150)\/numLine;\n    var x1 = 300; \/\/ x1 of line 1\n    var y1 = 0; \/\/y1 of line 1\n    var x2 = 0;  \/\/x1 of line 2\n    var y2 = 150; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLine; i += 1) {\n        stroke(\"green\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n\n    stroke(\"green\");  \/\/ green lines 5\n    line(150, 0, 0, 0);\n    line(0, 150, 300, 300);\n    dx1 = (0-150)\/numLine; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (0-0)\/numLine;\n    dx2 = (300-0)\/numLine;\n    dy2 = (300-150)\/numLine;\n    var x1 = 150; \/\/ x1 of line 1\n    var y1 = 0; \/\/y1 of line 1\n    var x2 = 0;  \/\/x1 of line 2\n    var y2 = 150; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLine; i += 1) {\n        stroke(\"green\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n    stroke(\"green\"); \/\/ green lines 6\n    line(150, 0, 0, 0);\n    line(0, 0, 0, 300);\n    dx1 = (0-150)\/numLines; \/\/make the lines 1\/50th of a step along the reference lines\n    dy1 = (0-0)\/numLines;\n    dx2 = (0-0)\/numLines;\n    dy2 = (300-0)\/numLines;\n    var x1 = 150; \/\/ x1 of line 1\n    var y1 = 0; \/\/y1 of line 1\n    var x2 = 0;  \/\/x1 of line 2\n    var y2 = 0; \/\/y1 of line 2\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(\"green\");\n        line(x1, y1, x2, y2);\n        x1 += dx1; \/\/ draw lines that are 1\/50th apart connecting them to other line \n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n    \n\n\n\n    noLoop();\n}<\/code><\/pre><\/div>\n\n\n\n<p>I tried to create a loose repetition effect. It took me a while to understand how the code works, but when I did, I was able to achieve what I had in mind.  <\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>I tried to create a loose repetition effect. It took me a while to understand how the code works, but when I did, I was able to achieve what I had in mind.<\/p>\n","protected":false},"author":776,"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\/f2022\/wp-json\/wp\/v2\/posts\/72656"}],"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\/776"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=72656"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72656\/revisions"}],"predecessor-version":[{"id":72660,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72656\/revisions\/72660"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=72656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=72656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=72656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}