{"id":501,"date":"2012-06-17T23:19:18","date_gmt":"2012-06-18T06:19:18","guid":{"rendered":"http:\/\/new.joyofprocessing.com\/blog\/?p=501"},"modified":"2012-06-17T23:19:18","modified_gmt":"2012-06-18T06:19:18","slug":"noise-loop","status":"publish","type":"post","link":"https:\/\/joyofprocessing.com\/blog\/2012\/06\/noise-loop\/","title":{"rendered":"Noise Loop"},"content":{"rendered":"<p><script type=\"application\/processing\">\/\/ Fun with Noise Loop - Jim Bumgardner\n\/\/\n\/\/ This demonstrates an interesting way of producing a particle system without the need to store\n\/\/ separate objects for each particle.\n\nfloat frequency = .001;\nfloat noiseInterval = PI; \/\/ Using an irrational number like PI (as opposed to an integer) prevents obvious pulsing\n                          \/\/ Due to noise's grid-like structure. To see what I mean, try using a value of 2,\n                          \/\/ instead of PI.\n\nvoid setup()\n{\n  size(500,500);\n  smooth();\n  background( 0 );\n  noStroke();\n  fill(#ffffff);\n  colorMode(HSB, 1);\n}\n\nvoid draw()\n{\n  colorMode(RGB, 256);\n  fill( 0,0,0, 10 );\n  rect(0,0,width,height);\n  noStroke();\n\n  colorMode(HSB, 1);\n  for (int i = 0; i < 300; ++i) {\n    float x = map(noise(i*noiseInterval + frameCount * frequency),0,1,0,width);\n    float y = map(noise(i*noiseInterval+1 + frameCount * frequency),0,1,0,height);\n    fill(i\/1000.0,.5,1);\n    ellipse(x,y,5,5);    \n  }\n}\n<\/script><\/p>\n<div class=\"ps_cap\"><a href=\"\/showexample.php?ex=noise_loop\">source<\/a><\/div>\n<p>This sketch demonstrates an interesting way of producing a particle system without the need to store separate objects for each particle. <\/p>\n<p>I&#8217;m using a 1-dimensional noise function to control the x and  y position of each particle, playing the noise like a needle plays a phonograph. For each particle, the needle for X and Y are dropped onto a different position in the noise stream.<\/p>\n<p>You&#8217;ll find the code to be remarkably compact.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>source This sketch demonstrates an interesting way of producing a particle system without the need to store separate objects for each particle. I&#8217;m using a 1-dimensional noise function to control the x and y position of each particle, playing the noise like a needle plays a phonograph. For each particle, the needle for X and [&hellip;]<\/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":[],"class_list":["post-501","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/501","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=501"}],"version-history":[{"count":4,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/501\/revisions"}],"predecessor-version":[{"id":505,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/501\/revisions\/505"}],"wp:attachment":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/media?parent=501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/categories?post=501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/tags?post=501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}