{"id":30,"date":"2011-02-12T04:38:39","date_gmt":"2011-02-12T04:38:39","guid":{"rendered":"http:\/\/classes.visitsteve.com\/hacking\/?p=30"},"modified":"2011-02-12T04:38:39","modified_gmt":"2011-02-12T04:38:39","slug":"random-line-maker","status":"publish","type":"post","link":"https:\/\/classes.visitsteve.com\/hacking\/random-line-maker\/","title":{"rendered":"Random Line Maker"},"content":{"rendered":"<p><script type=\"application\/processing\">\r\n\/\/Info: http:\/\/processingjs.org\/reference\r\n\/\/ Random Line Maker\r\n\/\/ I wanted to connect the lines, but I will come back to that idea\r\n\r\n\/\/ declare variables\r\n  \/\/colors\r\n  float r; \r\n  float g; \r\n  float b; \r\n  float a;\r\n  \r\n  \/\/construction\r\n  float startX = width\/2;\r\n  float startY = height; \r\n  float endX;\r\n  float endY;\r\n\r\nvoid setup() {\r\n\tsize(400,400); \r\n\tbackground(255); \r\n\tsmooth();\r\n\t}\r\nvoid draw() { \r\n    \/\/ pick a random color\r\n    r = random(255);\r\n    g = random(255);\r\n    b = random(255);\r\n    a = random(255);\r\n    \r\n    startX = random(width);\r\n    startY = random(height);\r\n    endX = random(width);\r\n    endY = random(height);\r\n\r\n    \/\/ create a random colored line of random dimensions\r\n    stroke(r,g,b,a);\r\n    line(startX,startY,endX,endY);\r\n    \r\n}\r\n\r\n\/\/ if the mouse is pressed, redraw the background\r\nvoid mousePressed() {\r\n  background(255);\r\n}\r\n<\/script><\/p>\n<h2> the code<\/h2>\n<p><code><br \/>\n\/\/ Random Line Maker<br \/>\n\/\/ I wanted to connect the lines, but I will come back to that idea<\/p>\n<p>\/\/ declare variables<br \/>\n  \/\/colors<br \/>\n  float r;<br \/>\n  float g;<br \/>\n  float b;<br \/>\n  float a;<\/p>\n<p>  \/\/construction<br \/>\n  float startX = width\/2;<br \/>\n  float startY = height;<br \/>\n  float endX;<br \/>\n  float endY;<\/p>\n<p>void setup() {<br \/>\n\tsize(400,400);<br \/>\n\tbackground(255);<br \/>\n\tsmooth();<br \/>\n\t}<br \/>\nvoid draw() {<br \/>\n    \/\/ pick a random color<br \/>\n    r = random(255);<br \/>\n    g = random(255);<br \/>\n    b = random(255);<br \/>\n    a = random(255);<\/p>\n<p>    startX = random(width);<br \/>\n    startY = random(height);<br \/>\n    endX = random(width);<br \/>\n    endY = random(height);<\/p>\n<p>    \/\/ create a random colored line of random dimensions<br \/>\n    stroke(r,g,b,a);<br \/>\n    line(startX,startY,endX,endY);<\/p>\n<p>}<\/p>\n<p>\/\/ if the mouse is pressed, redraw the background<br \/>\nvoid mousePressed() {<br \/>\n  background(255);<br \/>\n}<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>the code \/\/ Random Line Maker \/\/ I wanted to connect the lines, but I will come back to that idea \/\/ declare variables \/\/colors float r; float g; float b; float a; \/\/construction float startX = width\/2; float startY &hellip; <a href=\"https:\/\/classes.visitsteve.com\/hacking\/random-line-maker\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-classnews"],"_links":{"self":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/comments?post=30"}],"version-history":[{"count":0,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/posts\/30\/revisions"}],"wp:attachment":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/media?parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/categories?post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/tags?post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}