{"id":72694,"date":"2022-09-24T13:46:23","date_gmt":"2022-09-24T17:46:23","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=72694"},"modified":"2022-09-24T13:46:23","modified_gmt":"2022-09-24T17:46:23","slug":"project-04-string-art-4","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/24\/project-04-string-art-4\/","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><p>Move your mouse to create different forms!<\/p>\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-338.js\" data-width=\"300\" data-height=\"400\">sketch<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"300\" height=\"400\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Angela Yang\n\/\/Section C\n\nvar numLines = 100;\nvar r;\nvar g; \nvar b;\n\nfunction setup() {\n    createCanvas(300, 400);\n    r = random (0, 255); \n    g = random (20, 255);\n    b = random (100, 255);\n}\n\nfunction draw() {\n    background(\"#F6F4D8\");\n    \/\/The mouse controls the motion of the strings on canvas. \n    var x = constrain(mouseX, 50, width);\n    var y = constrain(mouseY, 50, height);\n  \n    \/\/Mirror x and y coordinates. \n    var x2 = width - x;\n    var y2 = height - y;\n\n  \n    \/\/ First set\n    \/\/The string is incremeting by 5 for each line that is drawn on canvas.\n    for (var i = 0; i &lt;=numLines; i += 5) {\n        stroke(r, g, b);\n          line(i, y2, x2, height + i);\n          line(width + i, y, x, i);\n          line(width + i, y2, x, height + i);\n          line(i, y, x2, i);\n    }\n    \n    \/\/Second Set\n    for (var i = 0; i &lt;=numLines; i += 10) {\n        stroke(0, 204, 204);\n           line(width - i, y, x2, height);\n           line(i, y2, x, i);\n           line(width - i, y2, x2, i);\n           line(i, y, x, height);\n      \n    \/\/Third Set\n    for (var i = 0; i &lt;=numLines; i += 5) {\n        stroke(0, 160, 150);\n           line(width - i, y, x2, height+i);\n           line(i, y2, x2, i);\n           line(width - i, y, x2, i);\n           line(i, y, x, height+i);\n    }\n  \n   }\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Move your mouse to create different forms! sketch \/\/Angela Yang \/\/Section C var numLines = 100; var r; var g; var b; function setup() { createCanvas(300, 400); r = random (0, 255); g = random (20, 255); b = random (100, 255); } function draw() { background(&#8220;#F6F4D8&#8221;); \/\/The mouse controls the motion of the strings &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/24\/project-04-string-art-4\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 04: String Art&#8221;<\/span><\/a><\/p>\n","protected":false},"author":774,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[102,57],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72694"}],"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\/774"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=72694"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72694\/revisions"}],"predecessor-version":[{"id":72695,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72694\/revisions\/72695"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=72694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=72694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=72694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}