{"id":72975,"date":"2022-09-24T23:59:04","date_gmt":"2022-09-25T03:59:04","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=72975"},"modified":"2022-09-24T23:59:04","modified_gmt":"2022-09-25T03:59:04","slug":"project-04-diagonal-sine-curve","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/24\/project-04-diagonal-sine-curve\/","title":{"rendered":"Project 04: Diagonal Sine Curve"},"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><a class=\"p5_sketch_link\" data-width=\"400\" data-height=\"300\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-378.js\">sketch<\/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\">\/\/Name: Hari Vardhan Sampath\n\/\/Section: E\n\/\/ Diagonal Sine Curves\n\nvar numLines = 45; \/\/number of strings drawn\n\nfunction setup() {\n    createCanvas(400, 300);\n    background(0);\n\n    \/\/ red strings\n    line(0, 0, 10, 150);\n    line(50, 200, 150, 150);\n\n    dx1 = (10-0)\/numLines;\n    dy1 = (150-0)\/numLines;\n    dx2 = (150-50)\/numLines;\n    dy2 = (150-200)\/numLines;\n\n    \/\/ yellow strings\n    line(250, 100, 150, 150);\n    line(400, 300, 390, 150);\n\n    dx3 = (150-250)\/numLines;\n    dy3 = (150-100)\/numLines;\n    dx4 = (390-400)\/numLines;\n    dy4 = (150-300)\/numLines;\n\n    \/\/ purple strings\n    line(150, 250, 150, 150);\n    line(400, 300, 250, 290);\n\n    dx5 = (150-150)\/numLines;\n    dy5 = (150-250)\/numLines;\n    dx6 = (250-400)\/numLines;\n    dy6 = (290-300)\/numLines;\n\n    \/\/ blue strings\n    line(100, 10, 0, 0);\n    line(150, 150, 150, 50);\n\n    dx7 = (0-100)\/numLines;\n    dy7 = (0-10)\/numLines;\n    dx8 = (150-150)\/numLines;\n    dy8 = (50-150)\/numLines;\n}\n\nfunction draw() {\n    \/\/ red strings\n    var x1 = 0;\n    var y1 = 0;\n    var x2 = 50;\n    var y2 = 200;\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(192, 57, 43);\n        line(x1, y1, x2, y2);\n        x1 += dx1;\n        y1 += dy1;\n        x2 += dx2;\n        y2 += dy2;\n    }\n    \/\/ yellow strings\n    var x3 = 250;\n    var y3 = 100;\n    var x4 = 400;\n    var y4 = 300;\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(244, 208, 63);\n        line(x3, y3, x4, y4);\n        x3 += dx3;\n        y3 += dy3;\n        x4 += dx4;\n        y4 += dy4;\n    }\n    \/\/ purple strings\n    var x5 = 150;\n    var y5 = 250;\n    var x6 = 400;\n    var y6 = 300;\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke('purple');\n        line(x5, y5, x6, y6);\n        x5 += dx5;\n        y5 += dy5;\n        x6 += dx6;\n        y6 += dy6;\n    }\n    var x7 = 100;\n    var y7 = 10;\n    var x8 = 150;\n    var y8 = 150;\n    for (var i = 0; i &lt;= numLines; i += 1) {\n        stroke(84, 153, 199);\n        line(x7, y7, x8, y8);\n        x7 += dx7;\n        y7 += dy7;\n        x8 += dx8;\n        y8 += dy8;\n    }\n\n    noLoop();\n}<\/code><\/pre><\/p>\n\n\n\n<p>In this project, I tried to explore the continuity of string art to form a sine curve, starting from the top left corner of the canvas until the diagonal bottom.<\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch \/\/Name: Hari Vardhan Sampath \/\/Section: E \/\/ Diagonal Sine Curves var numLines = 45; \/\/number of strings drawn function setup() { createCanvas(400, 300); background(0); \/\/ red strings line(0, 0, 10, 150); line(50, 200, 150, 150); dx1 = (10-0)\/numLines; dy1 = (150-0)\/numLines; dx2 = (150-50)\/numLines; dy2 = (150-200)\/numLines; \/\/ yellow strings line(250, 100, 150, 150); &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/24\/project-04-diagonal-sine-curve\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 04: Diagonal Sine Curve&#8221;<\/span><\/a><\/p>\n","protected":false},"author":756,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[102,121],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72975"}],"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\/756"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=72975"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72975\/revisions"}],"predecessor-version":[{"id":72989,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72975\/revisions\/72989"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=72975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=72975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=72975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}