{"id":66426,"date":"2021-09-25T22:14:42","date_gmt":"2021-09-26T02:14:42","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=66426"},"modified":"2021-09-25T22:14:42","modified_gmt":"2021-09-26T02:14:42","slug":"project-4-string-art-4","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/25\/project-4-string-art-4\/","title":{"rendered":"Project 4: 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\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/09\/wpf-string-art.js\" data-width=\"500\" data-height=\"300\">wpf-string-art<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"500\" height=\"300\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Patrick Fisher Section B\n\nvar dx1;\nvar dy1;\nvar dx2;\nvar dy2;\nvar numLines = 50;\n\nfunction setup() {\n    createCanvas(400, 300);\n    background(50);\n    fill(10);\n    rectMode(CENTER);\n    rect(200,150,250,250)\n    dx1 = (275-25)\/numLines;\n    dy1 = (275-25)\/numLines;\n    dx2 = (25-275)\/numLines;\n    dy2 = (25-275)\/numLines;\n}\n\nfunction draw() {\n    var x1 = 75;\n    var y1 = 25;\n    var x2 = 275;\n    var y2 = 275;\n    stroke(255,0,0,200);\n    for (var i = 0; i &lt;= numLines; i += 1) { \/\/crates x design that goes from upper left to bottom right\n        line(x1, y1, x2, y2);\n        x1 += dx1;\n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n\n    }\n\n    x1 = 375;\n    y1 = 25;\n    x2 = 75;\n    y2 = 275;\n    for ( i = 0; i &lt;= numLines; i += 1) { \/\/creates x design that goes from lower left to upper right\n        line(x1, y1, x2, y2);\n        x1 += -dx1;\n        y1 += dy1;\n        x2 += -dx2;\n        y2 += dy2;\n    }\n\n    dx1 = (325-25)\/numLines;\n    dy1 = (75-25)\/numLines;\n    dx2 = (25-275)\/numLines;\n    dy2 = (25-0)\/numLines;\n\n    x1 = 75;\n    y1 = 25;\n    x2 = 325;\n    y2 = 75;\n    stroke(0,0,255,200);\n    for ( i = 0; i &lt;= numLines; i += 1) { \/\/creates the blue pattern at the top\n        line(x1, y1, x2, y2);\n        x1 += dx1;\n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n\n    \n    }\n\n\n\n    x1 = 325;\n    y1 = 75;\n    x2 = 75;\n    y2 = 25;\n    for ( i = 0; i &lt;= numLines; i += 1) { \/\/creates the second half of the top blue pattern\n        line(x1, y1, x2, y2);\n        x1 += -dx1;\n        y1 += -dy1;\n        x2 += -dx2;\n        y2 += -dy2;\n\n    \n    }\n\n    x1 = 325;\n    y1 = 175;\n    x2 = 75;\n    y2 = 250;\n    stroke(0,0,255,200);\n    for ( i = 0; i &lt;= numLines; i += 1) { \/\/creates the botom blue pattern\n        line(x1, y1, x2, y2);\n        x1 += -dx1;\n        y1 += dy1;\n        x2 += -dx2;\n        y2 += dy2;   \n    }\n\n    x1 = 75;\n    y1 = 250;\n    x2 = 325;\n    y2 = 175;\n    stroke(0,0,255,200);\n    for ( i = 0; i &lt;= numLines; i += 1) { \/\/creates the top half of the bottom blue pattern\n        line(x1, y1, x2, y2);\n        x1 += dx1;\n        y1 += -dy1;\n        x2 += dx2;\n        y2 += -dy2;\n\n    }\n    noLoop();\n}<\/code><\/pre><\/div>\n\n\n\n<p>I really struggled with this project, both creatively and technically. I had to take the sample code and finger with it mostly randomly to create anything that I was remotely satisfied with it. <\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>wpf-string-art \/\/Patrick Fisher Section B var dx1; var dy1; var dx2; var dy2; var numLines = 50; function setup() { createCanvas(400, 300); background(50); fill(10); rectMode(CENTER); rect(200,150,250,250) dx1 = (275-25)\/numLines; dy1 = (275-25)\/numLines; dx2 = (25-275)\/numLines; dy2 = (25-275)\/numLines; } function draw() { var x1 = 75; var y1 = 25; var x2 = 275; var &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/09\/25\/project-4-string-art-4\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 4: String Art&#8221;<\/span><\/a><\/p>\n","protected":false},"author":648,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[102,56],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/66426"}],"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\/648"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=66426"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/66426\/revisions"}],"predecessor-version":[{"id":66429,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/66426\/revisions\/66429"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=66426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=66426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=66426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}