{"id":74,"date":"2015-06-16T05:16:05","date_gmt":"2015-06-16T01:16:05","guid":{"rendered":"http:\/\/courses.haigarmen.com\/creativecoding\/?p=74"},"modified":"2015-06-17T03:28:01","modified_gmt":"2015-06-16T23:28:01","slug":"exercise-13","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/creativecoding\/exercise-13\/","title":{"rendered":"Exercise 13"},"content":{"rendered":"<p>Making Rainbows<\/p>\n<pre><code>\r\n\/\/ initial position for our circle\r\nfloat circle_x = 300;\r\nfloat circle_y = 20;\r\n\/\/ how much to move the circle on each frame\r\nfloat move_x = 2;\r\nfloat move_y = -2;\r\n\r\nvoid setup() {\r\n  size(400, 200);\r\n  stroke(#D60DFF);\r\n  strokeWeight(7);\r\n}\r\nvoid draw() {\r\n  background(#21EA73);\r\n  ellipse(circle_x, circle_y, 40, 40);\r\n  circle_x = circle_x + move_x;\r\n  circle_y = circle_y + move_y;\r\n  \r\n  if(circle_x > width) {\r\n    circle_x = width;\r\n    move_x = -move_x;\r\n    println(\"too far right\");\r\n  }\r\n  if(circle_y > height) {\r\n    circle_y = height;\r\n    move_y = -move_y;\r\n    println(\"too far bottom\");\r\n  }\r\n  if(circle_x < 0) {\r\n    circle_x = 0;\r\n    move_x = -move_x;\r\n    println(\"too far left\");\r\n  }\r\n  if(circle_y < 0) {\r\n    circle_y = 0;\r\n    move_y = -move_y;\r\n    println(\"too far top\");\r\n  }\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Making Rainbows \/\/ initial position for our circle float circle_x = 300; float circle_y = 20; \/\/ how much to move the circle on each frame float move_x = 2; float move_y = -2; void setup() { size(400, 200); stroke(#D60DFF); strokeWeight(7); } void draw() { background(#21EA73); ellipse(circle_x, circle_y, 40, 40); circle_x = circle_x + move_x; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-lessons"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":3,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":77,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/74\/revisions\/77"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}