{"id":258,"date":"2015-06-23T10:50:24","date_gmt":"2015-06-23T06:50:24","guid":{"rendered":"http:\/\/courses.haigarmen.com\/creativecoding\/?p=258"},"modified":"2015-06-23T11:02:35","modified_gmt":"2015-06-23T07:02:35","slug":"bonus-glitch-2","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/creativecoding\/bonus-glitch-2\/","title":{"rendered":"Bonus: Glitch 2"},"content":{"rendered":"<pre><code>\r\nPImage img;\r\nint min = 40, max = 80;\r\nint r = 10;\r\n \r\nvoid setup() {\r\n  img = loadImage(\"https:\/\/s-media-cache-ak0.pinimg.com\/736x\/2c\/f6\/a5\/2cf6a58f75b368949cf98db03b925f1b.jpg\");\r\n  size(img.width, img.height);\r\n  image(img, 0, 0);\r\n}\r\n \r\nvoid draw() {\r\n  doStuff();\r\n}\r\n \r\nvoid keyPressed() {\r\n  save(random(123456)+\".jpg\");\r\n}\r\n \r\nvoid doStuff() {\r\n  PImage tmp = createImage(width, height, RGB);\r\n  tmp.loadPixels();\r\n  float rd = random(25, 100);\r\n  for (int px=0; px < width; px++) {\r\n    for (int py=0; py < height; py++) {\r\n      float br = brightness(img.get(px, py));\r\n      if (br>rd) tmp.pixels[py*width+px]=get(px, py);\r\n    }\r\n  }\r\n  tmp.updatePixels();\r\n  int v = (int)random(-r, r);\r\n  int v2 = (int)random(-r, r);\r\n  image(tmp, v, v2);\r\n}\r\n \r\nvoid mouseClicked() {\r\n  \/\/doStuff();\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PImage img; int min = 40, max = 80; int r = 10; void setup() { img = loadImage(&#8220;https:\/\/s-media-cache-ak0.pinimg.com\/736x\/2c\/f6\/a5\/2cf6a58f75b368949cf98db03b925f1b.jpg&#8221;); size(img.width, img.height); image(img, 0, 0); } void draw() { doStuff(); } void keyPressed() { save(random(123456)+&#8221;.jpg&#8221;); } void doStuff() { PImage tmp = createImage(width, height, RGB); tmp.loadPixels(); float rd = random(25, 100); for (int px=0; px < [&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-258","post","type-post","status-publish","format-standard","hentry","category-lessons"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/258","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=258"}],"version-history":[{"count":1,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/258\/revisions"}],"predecessor-version":[{"id":259,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/258\/revisions\/259"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/media?parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/categories?post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/tags?post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}