ROHRSCHACH ALGORYTHM

edited December 2013 in Share Your Work

Hey fellows, anybody saw the movie watchmen? I did and liked it a lot, and when i watched it i thought "omq i NEED such an animation". I played around a bit and soon figured out how to create a nice effect with this. I turned it on as a screensaver, and soon folks asked me to share it. It is nothing that special, but since i searched a way to move around my player in a 2d video game and INSTANT found a nice, working solution in this forum, i felt like "well, give something back therefore". So here is my "Tubechess", hope you like it. Look at it for at least 1 minute and you will start to see pictures created by your subconscious mind.

            float XX=width/2;    
            float XY=height/2;

            void setup(){
              int a=displayWidth;
              int b=displayHeight;
            size(displayWidth, displayHeight, P3D);
              if (frame != null)frame.setResizable(true);


              background(#FFFFFF);
              frameRate(100);
              smooth();

            }

            void draw(){
              float size = random(200);
              float mouseParam=size/2;

              XX+=getRandomMove();
              XY+=getRandomMove();


              //objekt darf nicht aus bildschirm fliehen
              if(XX<0||XX>width)
              XX=0;

              if(XY<0)
              XY=0;

              if(XY>height)
              XY=height;

              fill(0,random(0,random(width/3)));
              rect(XX-mouseParam, XY-mouseParam, size, size, random(90), random(90), random(90), random(90));

              fill(0,random(0,random(width/3)));
              rect(width-XX-mouseParam, XY-mouseParam, size, size, random(90), random(90), random(90), random(90));

              //langsames auflösen des gebildes
              fill(random(255),random(255),random(255),random(0,1.151));
              ellipse(height,width,height*3,width*3);

            }

            float getRandomMove(){

              return random(-60,60);

            }

NOTE: This ain't perfect. If you change size of frame, it will clean the background while the size of the random patterns stays the same. This could be fixed, but my intention was to create a code as simple as i could. I hope you like it.

Tagged:
Sign In or Register to comment.