{"id":260,"date":"2015-06-23T11:03:48","date_gmt":"2015-06-23T07:03:48","guid":{"rendered":"http:\/\/courses.haigarmen.com\/creativecoding\/?p=260"},"modified":"2015-06-29T14:56:35","modified_gmt":"2015-06-29T10:56:35","slug":"bonus-circular-galaxy","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/creativecoding\/bonus-circular-galaxy\/","title":{"rendered":"Bonus: Circular Galaxy"},"content":{"rendered":"<pre><code>\r\nint num = 40, circles=80, frames=60;\r\nfloat theta;\r\n \r\nvoid setup() {\r\n  size(540, 540);\r\n}\r\n \r\nvoid draw() {\r\n  randomSeed(3453);\r\n  background(0);\r\n  noStroke();\r\n  float angle = 0;\r\n  for (int j=0; j < circles; j++) {\r\n    fill(255, 25);\r\n    float r = random(TWO_PI);\r\n    beginShape(TRIANGLE_STRIP);\r\n    float r2 = random(30, 50);\r\n    for (int i=0; i < num; i++) {\r\n      angle=TWO_PI\/num*i+r;\r\n      float offSet=TWO_PI\/num*i;\r\n      float d = 120+cos(offSet*3)*r2;\r\n      float x = width\/2 +sin(theta+offSet)*10 + sin(angle)*d;\r\n      float y = height\/2 + cos(theta+offSet)*10 + cos(angle)*d;\r\n      vertex(x, y);\r\n      ellipse(x, y, 3, 3);\r\n    }  \r\n    endShape(CLOSE);\r\n  }\r\n  theta+=TWO_PI\/frames;\r\n  \/\/if (frameCount <= frames) saveFrame(\"imge-###.gif\");\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>int num = 40, circles=80, frames=60; float theta; void setup() { size(540, 540); } void draw() { randomSeed(3453); background(0); noStroke(); float angle = 0; for (int j=0; j < circles; j++) { fill(255, 25); float r = random(TWO_PI); beginShape(TRIANGLE_STRIP); float r2 = random(30, 50); for (int i=0; i < num; i++) { angle=TWO_PI\/num*i+r; float offSet=TWO_PI\/num*i; [&hellip;]\n<\/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-260","post","type-post","status-publish","format-standard","hentry","category-lessons"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/260","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=260"}],"version-history":[{"count":1,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":261,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/260\/revisions\/261"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/media?parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/categories?post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/tags?post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}