{"id":164,"date":"2015-06-18T03:37:08","date_gmt":"2015-06-17T23:37:08","guid":{"rendered":"http:\/\/courses.haigarmen.com\/creativecoding\/?p=164"},"modified":"2015-06-18T03:37:08","modified_gmt":"2015-06-17T23:37:08","slug":"exercise-31","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/creativecoding\/exercise-31\/","title":{"rendered":"Exercise 31"},"content":{"rendered":"<p>Let\u2019s start simple. The following listing creates a script that draws a handful of randomly placed circles every time the mouse is clicked.<\/p>\n<pre><code>\r\nint _num = 10;\r\nvoid setup() {\r\n  size(500, 300);\r\n  background(255);\r\n  smooth();\r\n  strokeWeight(1);\r\n  fill(150, 50);\r\n  drawCircles();\r\n}\r\nvoid draw() {\r\n}\r\nvoid mouseReleased() {\r\n  drawCircles();\r\n}\r\nvoid drawCircles() {\r\n  for (int i=0; i<_num; i++) {\r\n    float x = random(width);\r\n    float y = random(height);\r\n    float radius = random(100) + 10;\r\n    noStroke();\r\n    ellipse(x, y, radius*2, radius*2);\r\n    stroke(0, 150);\r\n    ellipse(x, y, 10, 10);\r\n  }\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Let\u2019s start simple. The following listing creates a script that draws a handful of randomly placed circles every time the mouse is clicked. int _num = 10; void setup() { size(500, 300); background(255); smooth(); strokeWeight(1); fill(150, 50); drawCircles(); } void draw() { } void mouseReleased() { drawCircles(); } void drawCircles() { for (int i=0; i<\/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-164","post","type-post","status-publish","format-standard","hentry","category-lessons"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/164","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=164"}],"version-history":[{"count":2,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/164\/revisions"}],"predecessor-version":[{"id":166,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/164\/revisions\/166"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/media?parent=164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/categories?post=164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/tags?post=164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}