Advertisement
xeromino

noiseloop

Jul 4th, 2015
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. int step=2, frames=300;
  2. float xOff, yOff, theta, sx, sy;
  3.  
  4. void setup() {
  5.   size(540, 400);
  6.   //colorMode(HSB, 360, 100, 100);
  7.   createStuff();
  8.   sx = random(10000);
  9.   sy = random(1000);
  10. }
  11.  
  12. void draw() {
  13.   createStuff();
  14.   theta += TWO_PI/frames;
  15.   //if (frameCount<=frames) saveFrame("image-###.gif");
  16. }
  17.  
  18. void keyPressed() {
  19.   save(random(123)+".jpg");
  20. }
  21.  
  22. void mouseReleased() {
  23.   background(0);
  24.   sx = random(200);
  25.   sy = sx + random(10000);
  26.   createStuff();
  27. }
  28.  
  29. void createStuff() {
  30.   xOff = sx;
  31.   for (int x=0; x<width; x+=step) {
  32.     yOff = sy;
  33.     for (int y=0; y<height; y+=step) {
  34.       int col = (int) map(noise(xOff+sin(theta), yOff+cos(theta), sin(theta)), 0, 1, 0, 255);
  35.       fill(col,50,80);
  36.       noStroke();
  37.       rect(x, y, step, step);
  38.       yOff += 0.005;
  39.     }
  40.     xOff += 0.05;
  41.   }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement