{"id":553,"date":"2012-11-12T15:16:26","date_gmt":"2012-11-12T15:16:26","guid":{"rendered":"http:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/?p=553"},"modified":"2012-11-12T15:16:26","modified_gmt":"2012-11-12T15:16:26","slug":"bouncy-squishy-rectangle","status":"publish","type":"post","link":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2012\/11\/12\/bouncy-squishy-rectangle\/","title":{"rendered":"Bouncy Squishy Rectangle"},"content":{"rendered":"<p><script type=\"application\/processing\">\r\n\/\/Info: http:\/\/processingjs.org\/reference\r\n\r\nint x = 10;\r\nint y = 200;\r\nint w = 200;\r\nint h = 200;\r\nint i = 2;\r\nint ix = i;\r\nint iy = i;\r\n\r\nvoid setup()\r\n{\r\n  background(0);\r\n  size(1000, 1000);\r\n}\r\n\r\nvoid draw()\r\n{\r\n  noFill();\r\n  stroke(256,256,256);\r\n  \r\n  rect(float(x),float(y),float(x),float(y));\r\n  \r\n  \/\/ellipse(mouseX, mouseY, pmouseX, pmouseY);\r\n  \r\n  move();\r\n  \r\n}\r\n\r\nvoid move()\r\n{\r\n  x = x+ix;\r\n  y = y+iy;\r\n  w = x;\r\n  h = y;\r\n  \r\n  checkBound();\r\n}\r\n\r\nvoid checkBound()\r\n{\r\n  if ((x+w >= 1000) && (ix == i))\r\n    ix = -i;\r\n  else if ((x < 0) && (ix == -i))\r\n    ix = i;\r\n  \r\n  if ((y+h >= 1000) && (iy == i))\r\n    iy = -i;\r\n  else if ((y <= 0) && (iy == -i))\r\n    iy = i;\r\n}\r\n<\/script><\/p>\n<p>A little thing I made during class. It looks like a 90&#8217;s screensaver. Could use some noise to slightly randomize the bounce, perhaps?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A little thing I made during class. It looks like a 90&#8217;s screensaver. Could use some noise to slightly randomize the bounce, perhaps?<\/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\/553"}],"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=553"}],"version-history":[{"count":1,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/553\/revisions"}],"predecessor-version":[{"id":555,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/553\/revisions\/555"}],"wp:attachment":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/media?parent=553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/categories?post=553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/tags?post=553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}