{"id":72864,"date":"2022-09-25T17:12:14","date_gmt":"2022-09-25T21:12:14","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=72864"},"modified":"2022-09-25T17:12:14","modified_gmt":"2022-09-25T21:12:14","slug":"string-art-bike","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/25\/string-art-bike\/","title":{"rendered":"String Art Bike"},"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>I started this project because I was inspired by the spokes on the bike. They looked like something that would lend itself to string art. After that, I wanted to make it look like the bike was moving so I had the positions of the spokes change and added the cactus in the back. Additionally, the color of the sky changes over time.<\/p><div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-359.js\" data-width=\"400\" data-height=\"300\">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\">\/\/Nakshatra Menon\n\/\/Section C\n\nfunction setup() {\n    createCanvas(400, 300);\n    background(200);\n}\n\nvar bikeWheel = 50;\nvar heightGround = 250;\nvar wheel = 1\nvar numLines = 10\nvar color3 = 100\nvar cactusX = 500\nvar cactusY = 200\n\nfunction draw() {\n    background(246, 235, 216);\n    var skyX = 0\n    var skyX2 = 600\n    var skyY2 = 125 \n    for (var skyY = 0; skyY&lt;250; skyY+= 8){           \/\/drawing the lines for sky \n        strokeWeight(.5);\n        stroke(71, 61, color3)\n        line(skyX, skyY, skyX2, skyY2);\n    }\n\n    var x1 = 0;\n    var y1 = 300;\n    var x2 = 400;\n    var y2 = 250;\n    var y3 = 275\n    \/\/ground \n    for (var y1=300; y1&gt;=250; y1+=-2) {               \/\/ground right up \n        stroke(159, 135, 94);\n        strokeWeight(1); \n        line(x1, y1, x2, y2);\n    }\n    for (var y2; y2&lt;= 300; y2 +=2){     \/\/ground left up \n        stroke(82, 66, 38);\n        strokeWeight(1); \n        line(x1, y1, x2, y2);\n    }\n    for(var y3 = 275; y3 &lt;= 300; y3 +=2){     \/\/ground across \n        stroke(198, 184, 153);\n        line(x1, y3, x2, y3);\n    }\n    \/\/cactus\n    fill(53, 68, 52);\n    ellipse(cactusX-20, cactusY, 35, 15);       \/\/ left\n    ellipse(cactusX+20, cactusY-20, 45, 15);   \/\/ right arm\n    ellipse(cactusX-35, cactusY-12, 10, 25); \/\/ top left \n    ellipse(cactusX, cactusY, 20, 100);     \/\/main \n    ellipse(cactusX+40, cactusY-30, 5, 15);  \/\/right top \n\n    \/\/ bike wheel arcs \n    noFill();\n    strokeWeight(7);\n    stroke(115, 45, 4);\n    arc(100, heightGround-bikeWheel-5, 2*bikeWheel, 2*bikeWheel, radians(190), radians(0));   \/\/ arc on left tire \n    arc(300, heightGround-bikeWheel-5, 2*bikeWheel, 2*bikeWheel, radians(190), radians(0));   \/\/arc on right tire  \n    \/\/ bike from right wheel   \n    push();\n    translate(300, heightGround-bikeWheel);             \/\/moving wheel to correct place\n    rotate(radians(-163))       \/\/ rotating line 9 degrees evertime it draws a new line\n    line(0,0,60,bikeWheel+45);  \n    line(50, bikeWheel+45, 70, bikeWheel+55 )     \/\/ far handle              \/\/ drawing vertical line \n    line(60, bikeWheel+45,80, bikeWheel+45)       \/\/ close handle \n    pop();\n    \/\/ bike from left wheel   \n    push();\n    translate(100, heightGround-bikeWheel);             \/\/moving origin to correct place\n    rotate(radians(-163))       \/\/ rotating lines\n    line(-60,bikeWheel-30,-150,bikeWheel+70);          \/\/ across\n    line(0,0,-60,bikeWheel-30);           \/\/ line to the line holding seat                                       \/\/ drawing vertical line \n    line(-60, bikeWheel-30, -20, 90)      \/\/ line holding up seat\n    push();\n    rotate(radians(-30));\n    ellipse(-60, 70, 60, 6);\n    pop();\n    line(0,0,-30,bikeWheel+15);           \/\/ line 2 to the line holding seat\n    line(-30,bikeWheel+15, -150, bikeWheel+70);    \/\/across 2\n    pop(); \n\n    \/\/ bike wheel left \n    if(wheel &lt;= 1){\n        for(var i=0; i&lt;4*numLines; i += 1){          \/\/ how many times it runs (4*numlines to get it to 360)\n            stroke(64, 38, 22);                          \/\/ shade of brown\n            strokeWeight(.5); \n            push();\n            translate(100, heightGround-bikeWheel);             \/\/moving wheel to correct place\n            rotate(radians((i\/2)*180\/numLines))       \/\/ rotating line 9 degrees evertime it draws a new line\n            line(0,0,0,bikeWheel);                    \/\/ drawing vertical line \n            pop();\n        }\n    }\n    if ( wheel &lt;= 2 & wheel > 1){\n        for( var i=0; i&lt;6*numLines; i += 1){          \/\/ how many times it runs (4*numlines to get it to 360)\n            stroke(64, 38, 22);                          \/\/ shade of brown\n            strokeWeight(.5); \n            push();\n            translate(100, heightGround-bikeWheel);             \/\/moving wheel to correct place\n            rotate(radians((i\/3)*180\/numLines))       \/\/ rotating line 9 degrees evertime it draws a new line\n            line(0,0,0,bikeWheel);                    \/\/ drawing vertical line \n            pop();\n        }\n    }\n\n    \/\/ bike wheel right\n    if(wheel &lt;= 1){\n        for(var i=0; i&lt;4*numLines; i += 1){          \/\/ how many times it runs (4*numlines to get it to 360)\n            stroke(64, 38, 22);                          \/\/ shade of brown\n            strokeWeight(.5); \n            push();\n            translate(300, heightGround-bikeWheel);             \/\/moving wheel to correct place\n            rotate(radians((i\/2)*180\/numLines))       \/\/ rotating line 9 degrees evertime it draws a new line\n            line(0,0,0,bikeWheel);                    \/\/ drawing vertical line \n            pop();\n        }\n    }\n    if ( wheel &lt;= 2 & wheel > 1){\n        for( var i=0; i&lt;6*numLines; i += 1){          \/\/ how many times it runs (4*numlines to get it to 360)\n            stroke(64, 38, 22);                          \/\/ shade of brown\n            strokeWeight(.5); \n            push();\n            translate(300, heightGround-bikeWheel);             \/\/moving wheel to correct place\n            rotate(radians((i\/3)*180\/numLines))       \/\/ rotating line 9 degrees evertime it draws a new line\n            line(0,0,0,bikeWheel);                    \/\/ drawing vertical line \n            pop();\n        }\n    }\n\n    \/\/bike tire left \n    push();\n    noFill();\n    strokeWeight(4);\n    stroke(64, 38, 22)\n    translate(100, heightGround-bikeWheel);\n    circle(0,0,2*bikeWheel);                      \/\/ drawing the tire \n    pop();\n    \/\/bike tire right \n    push();\n    noFill();\n    strokeWeight(4);\n    stroke(64, 38, 22)\n    translate(300, heightGround-bikeWheel);\n    circle(0,0,2*bikeWheel);                       \n    pop();\n\n    wheel += .1                                   \/\/ wheels move \n    if (wheel &gt; 2){\n        wheel = 0;\n    }\n\n    color3 += .5                                  \/\/ color of sky changes \n    if (color3 &gt; 300){\n        color3 = 100\n    }\n\n    cactusX += -5                                \/\/ cactus moves \n    if (cactusX &lt; -100){\n        cactusX = 500\n    }\n}\n<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>I started this project because I was inspired by the spokes on the bike. They looked like something that would lend itself to string art. After that, I wanted to make it look like the bike was moving so I had the positions of the spokes change and added the cactus in the back. Additionally, &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/25\/string-art-bike\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;String Art Bike&#8221;<\/span><\/a><\/p>\n","protected":false},"author":746,"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\/72864"}],"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\/746"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=72864"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72864\/revisions"}],"predecessor-version":[{"id":73052,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/72864\/revisions\/73052"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=72864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=72864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=72864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}