{"id":204,"date":"2015-06-18T06:18:51","date_gmt":"2015-06-18T02:18:51","guid":{"rendered":"http:\/\/courses.haigarmen.com\/creativecoding\/?p=204"},"modified":"2015-06-18T18:49:49","modified_gmt":"2015-06-18T14:49:49","slug":"exercise-42","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/creativecoding\/exercise-42\/","title":{"rendered":"Exercise 42"},"content":{"rendered":"<pre><code>\r\nint frames = 235, num=30;\r\nfloat theta;\r\n \r\nvoid setup() {\r\n  size(750, 750);\r\n  rectMode(CENTER);\r\n}\r\n \r\nvoid draw() {\r\n  background(20);\r\n  noFill();\r\n  translate(width\/2, height\/2);\r\n  for (int i=0; i < num; i++) {\r\n    pushMatrix();\r\n    float offSet=TWO_PI\/num*i;\r\n    rotate(offSet);\r\n    float sz = map(sin(theta), -1, 1, width*.15, width*.2);\r\n    float x = map(sin(theta), -1, 1, sz, width*.2);\r\n    translate(x, 0);\r\n    pushMatrix();\r\n    rotate(theta);\r\n      stroke(200);\r\n    if (i%2==0) {\r\n      ellipse(0, 0, sz, sz*2);\r\n      float px = cos(theta)*sz\/2;\r\n      float py = sin(theta)*sz;\r\n      float sz2 = 20;\r\n      strokeWeight(2);\r\n      ellipse(px, py, sz2, sz2);\r\n      strokeWeight(1);\r\n    } else {\r\n      fill(255,20);\r\n      noStroke();\r\n      ellipse(0, 0, sz*.7, sz*2*.7);\r\n      float px = cos(theta+PI)*sz*.35;\r\n      float py = sin(theta+PI)*sz*.7;\r\n      float sz2 = 5;\r\n      fill(255);\r\n      ellipse(px, py, sz2, sz2);\r\n      noFill();\r\n    }\r\n    popMatrix();\r\n    popMatrix();\r\n  }\r\n  theta += TWO_PI\/frames;\r\n  \/\/if (frameCount<=frames) saveFrame(\"image-###.png\");\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>int frames = 235, num=30; float theta; void setup() { size(750, 750); rectMode(CENTER); } void draw() { background(20); noFill(); translate(width\/2, height\/2); for (int i=0; i < num; i++) { pushMatrix(); float offSet=TWO_PI\/num*i; rotate(offSet); float sz = map(sin(theta), -1, 1, width*.15, width*.2); float x = map(sin(theta), -1, 1, sz, width*.2); translate(x, 0); pushMatrix(); rotate(theta); stroke(200); if [&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-204","post","type-post","status-publish","format-standard","hentry","category-lessons"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/204","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=204"}],"version-history":[{"count":2,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/204\/revisions"}],"predecessor-version":[{"id":213,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/204\/revisions\/213"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/media?parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/categories?post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/tags?post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}