{"id":421,"date":"2012-11-11T19:08:33","date_gmt":"2012-11-11T19:08:33","guid":{"rendered":"http:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/?p=421"},"modified":"2012-11-11T19:09:16","modified_gmt":"2012-11-11T19:09:16","slug":"bubbly-ripples","status":"publish","type":"post","link":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2012\/11\/11\/bubbly-ripples\/","title":{"rendered":"Bubbly Ripples"},"content":{"rendered":"<p>This sketch was inspired by water ripples, and I wanted to work with arrays in moving images, so this sketch uses arrays to move the bubbles around. The finished program reminds me of soda now.<\/p>\n<p><script type=\"application\/processing\">\r\nripple waterRipple;\r\nripple[] ripples = new ripple[100];\r\n\r\nvoid setup() {\r\n  size(500, 500);\r\n  \/\/background (93, 84, 232);\r\n  background (250,63,88);\r\n  ellipseMode(CENTER);\r\n\r\n  for (int i=0;i<ripples.length;i++) {\r\n    ripples[i]=new ripple();\r\n  }\r\n}\r\n\r\nvoid draw() {\r\n  \/\/background (93, 84, 232);\r\n  background (250,63,88);\r\n  for (int z=0;z<ripples.length;z++) {\r\n    ripples[z].moveripple();\r\n    ripples[z].drawripple();\r\n  }\r\n} \r\n\r\nclass ripple {\r\n  float x;\r\n  float y;\r\n  float rippleSize;\r\n  float xmoveAmount;\r\n  float ymoveAmount;\r\n  color randColor;\r\n\r\n  ripple() {\r\n    x = random(width);\r\n    y = random(height);\r\n    xmoveAmount = 10;\r\n    ymoveAmount = 10;\r\n    rippleSize = 10 + random(40);\r\n    randColor = color(random(255), random(255), random(255));\r\n  }\r\n\r\nvoid drawripple() {\r\n  stroke(randColor);\r\n  fill(93, 84, 232);\r\n  ellipse(x, y, rippleSize, rippleSize);\r\n}\r\n\r\nvoid moveripple() {\r\n  x+=xmoveAmount;\r\n  y+=ymoveAmount;\r\n  \r\n  if (x>=(width-rippleSize\/2)) {\r\n    xmoveAmount = 0-xmoveAmount;\r\n  }\r\n  else if (x<=rippleSize\/2) {\r\n    xmoveAmount = 0-xmoveAmount;\r\n  }\r\n  else if (y>=(height-rippleSize\/2)) {\r\n    ymoveAmount = 0-ymoveAmount;\r\n  }\r\n  else if (y<=rippleSize\/2) {\r\n    ymoveAmount = 0-ymoveAmount;\r\n  }\r\n}\r\n}\r\n\r\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This sketch was inspired by water ripples, and I wanted to work with arrays in moving images, so this sketch uses arrays to move the bubbles around. The finished program reminds me of soda now.<\/p>\n","protected":false},"author":22,"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\/421"}],"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\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/comments?post=421"}],"version-history":[{"count":3,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/421\/revisions"}],"predecessor-version":[{"id":424,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/421\/revisions\/424"}],"wp:attachment":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/media?parent=421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/categories?post=421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/tags?post=421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}