{"id":491,"date":"2012-03-06T09:42:22","date_gmt":"2012-03-06T17:42:22","guid":{"rendered":"http:\/\/new.joyofprocessing.com\/blog\/?p=491"},"modified":"2012-03-06T09:42:22","modified_gmt":"2012-03-06T17:42:22","slug":"spiral-feedback","status":"publish","type":"post","link":"https:\/\/joyofprocessing.com\/blog\/2012\/03\/spiral-feedback\/","title":{"rendered":"Spiral Feedback"},"content":{"rendered":"<p><script type=\"application\/processing\">\/\/ Spiral Feedback by Jim Bumgardner\n\/\/\nint currentFrame = 0;\nint max_frames = 24;\nPImage[] frames = new PImage[max_frames];\n\nfloat r = 0;\nfloat a = 0;\nfloat maxRad = 240;\nfloat cx,cy;\nfloat phi = (sqrt(5)+1)\/2 - 1;            \/\/ golden ratio\nfloat golden_angle = phi * TWO_PI;        \/\/ golden angle\nfloat angleIncrement = golden_angle \/ (24*PI);\n\nvoid setup() {\n  size(500,500);\n  cx = width\/2;\n  cy = height\/2;\n  smooth();\n  background(255);\n  frameRate(24);\n  noStroke();\n  fill(0);\n  colorMode(HSB,1);\n}\n  \nvoid draw()\n{\n  frames[currentFrame] = get(); \/\/ Get the display window\n  currentFrame = (currentFrame + 1) % max_frames;\n  if (frames[currentFrame] != null) {\n    image(frames[currentFrame], 0, 0);\n  }\n  if (frameCount <= max_frames)\n    background(#FFFFFF);\n\n  a += angleIncrement;\n  if (a > TWO_PI)\n      a -= TWO_PI;\n  r = sin(frameCount\/24.0)*maxRad;\n  float x = cx + sin(a)*r;\n  float y = cy + cos(a)*r;\n  fill(sin(millis()*.001)*.5+.5,1,.8, .5);\n  ellipse(x, y, 10, 10);\n}\n<\/script><\/p>\n<div class=\"ps_cap\"><a href=\"\/showexample.php?ex=spiral_feedback\">source<\/a><\/div>\n<p>\n","protected":false},"excerpt":{"rendered":"<p>source<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[38,37,35,36,13],"class_list":["post-491","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-circle","tag-feedback","tag-golden-angle","tag-phyllotaxy","tag-spiral"],"_links":{"self":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/comments?post=491"}],"version-history":[{"count":3,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/491\/revisions"}],"predecessor-version":[{"id":494,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/491\/revisions\/494"}],"wp:attachment":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/media?parent=491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/categories?post=491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/tags?post=491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}