{"id":198,"date":"2015-06-18T06:08:47","date_gmt":"2015-06-18T02:08:47","guid":{"rendered":"http:\/\/courses.haigarmen.com\/creativecoding\/?p=198"},"modified":"2015-06-18T18:49:32","modified_gmt":"2015-06-18T14:49:32","slug":"exercise-40","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/creativecoding\/exercise-40\/","title":{"rendered":"Exercise 40"},"content":{"rendered":"<p>Outputting an animation as video takes two steps<\/p>\n<ol>\n<li>saving frames of the animation as separate image files<\/li>\n<li>compiling the sequence of images into a movie using MovieMaker tool<\/li>\n<\/ol>\n<pre><code>\r\nint frames = 200, num=20;\r\nfloat theta;\r\n \r\nvoid setup() {\r\n  size(750, 750);\r\n}\r\n \r\nvoid draw() {\r\n  background(20);\r\n  fill(255, 30);\r\n  stroke(255, 50);\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 = width*.15;\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    ellipse(0, 0, sz, sz*2);\r\n    ellipse(0, 0, sz*.7, sz*2*.7);\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>Outputting an animation as video takes two steps saving frames of the animation as separate image files compiling the sequence of images into a movie using MovieMaker tool int frames = 200, num=20; float theta; void setup() { size(750, 750); } void draw() { background(20); fill(255, 30); stroke(255, 50); translate(width\/2, height\/2); for (int i=0; i [&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-198","post","type-post","status-publish","format-standard","hentry","category-lessons"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/198","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=198"}],"version-history":[{"count":3,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/198\/revisions"}],"predecessor-version":[{"id":201,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/198\/revisions\/201"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/media?parent=198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/categories?post=198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/tags?post=198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}