{"id":531,"date":"2012-11-12T15:10:33","date_gmt":"2012-11-12T15:10:33","guid":{"rendered":"http:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/?p=531"},"modified":"2012-11-12T15:10:33","modified_gmt":"2012-11-12T15:10:33","slug":"simple-colors-swoosh-about","status":"publish","type":"post","link":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2012\/11\/12\/simple-colors-swoosh-about\/","title":{"rendered":"Simple Colors Swoosh About"},"content":{"rendered":"<p><script type=\"application\/processing\">\r\n\/\/Info: http:\/\/processingjs.org\/reference\r\nint p1 = 0;\r\nint p2 = 0;\r\nint p3 = 1000;\r\nint p4 = 1000;\r\nint r = 0;\r\nint g = 0;\r\nint b = 0;\r\ncolor c = color(r, g, b);\r\n\r\nint d = 1;\r\nint which = 1;\r\n\r\nvoid setup()\r\n{\r\n  size(1000, 1000);\r\n  background(0);\r\n}\r\n\r\nvoid draw()\r\n{\r\n  stroke(c);\r\n  \r\n  if ((p1 <= 0) && (p2 <= 0))\r\n  {\r\n    d = 1;\r\n    p1 = 0;\r\n    p2 = 0;\r\n    p3 = 1000;\r\n    p4 = 1000;\r\n  }\r\n  if ((p1 >= 1000) && (p2 <= 0))\r\n  {\r\n    d = 2;\r\n    p1 = 1000;\r\n    p2 = 0;\r\n    p3 = 0;\r\n    p4 = 1000;\r\n  }\r\n  if ((p1 >= 1000) && (p2 >= 1000))\r\n  {\r\n    d = 3;\r\n    p1 = 1000;\r\n    p2 = 1000;\r\n    p3 = 0;\r\n    p4 = 0;\r\n  }\r\n  if ((p1 <= 0) && (p2 >= 1000))\r\n  {\r\n    d = 4;\r\n    p1 = 0;\r\n    p2 = 1000;\r\n    p3 = 1000;\r\n    p4 = 0;\r\n  }\r\n  \r\n  \r\n  switch(d) {\r\n    case 1:\r\n      p1 = p1+1;\r\n      p3 = p3-1;\r\n      p4 = int(random(900, 1000));\r\n      break;\r\n    case 2:\r\n      p2 = p2+1;\r\n      p4 = p4-1;\r\n      p3 = int(random(900, 1000));\r\n      break;\r\n    case 3:\r\n      p1 = p1-1;\r\n      p3 = p3+1;\r\n      p4 = int(random(900, 1000));\r\n      break;\r\n    case 4:\r\n      p2 = p2-1;\r\n      p4 = p4+1;\r\n      p3 = int(random(900, 1000));\r\n      break;\r\n  }\r\n  \r\n  line(p1, p2, p3, p4);\r\n  \r\n  \/\/line(random(0, 100), p1, random(900, 1000), p2);\r\n  \r\n  \r\n  c = color(r, g, b);\r\n  \r\n  changeColor();\r\n}\r\n\r\nvoid changeColor()\r\n{\r\n  if (which == 1) {\r\n    if (r >= 256)\r\n    {\r\n      r = 0;\r\n      which = 2;\r\n    }\r\n    else r = r+1;\r\n  }\r\n  \r\n  if (which == 2) {\r\n    if (g >= 256)\r\n    {\r\n      g = 0;\r\n      which = 3;\r\n    }\r\n    else g = g+1;\r\n  }\r\n  \r\n  if (which == 3) {\r\n    if (b >= 256)\r\n    {\r\n      b = 0;\r\n      which = 1;\r\n    }\r\n    else b = b+1;\r\n  }\r\n}\r\n<\/script><\/p>\n<p>This took a few iterations, and it didn&#8217;t turn out exactly the way I wanted. I wanted it to just go all the way around in a circle, but people seemed to like it when the center point jumped to the side and moved around. So I kept it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This took a few iterations, and it didn&#8217;t turn out exactly the way I wanted. I wanted it to just go all the way around in a circle, but people seemed to like it when the center point jumped to &hellip; <a href=\"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2012\/11\/12\/simple-colors-swoosh-about\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/531"}],"collection":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/comments?post=531"}],"version-history":[{"count":1,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/531\/revisions"}],"predecessor-version":[{"id":542,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/531\/revisions\/542"}],"wp:attachment":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/media?parent=531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/categories?post=531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/tags?post=531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}