Advertisement
xeromino

lipp

Nov 9th, 2014
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. PImage img;
  2. int step = 10, num=10;
  3.  
  4. void setup() {
  5.   img=loadImage("http://media-cache-ak0.pinimg.com/736x/3a/0f/c5/3a0fc551cf2ff049aa6874f5ef10b2a7.jpg");
  6.   size(img.width, img.height);
  7.   background(0);
  8.   noStroke();
  9.   float xstart = random(10);
  10.   float xnoise = xstart;
  11.   float ynoise = random(10);
  12.   for (int i=0; i<num; i++) {
  13.     float offSet = random(-step/2, step/2);
  14.     for (int y=0; y<height; y+=step) {
  15.       xnoise = xstart;
  16.       ynoise += .1;
  17.       for (int x=0; x<width; x+=step) {
  18.         xnoise += .1;
  19.         drawPoint(x, y, noise(xnoise, ynoise), offSet);
  20.       }
  21.     }
  22.   }
  23. }
  24.  
  25. void drawPoint(float x, float y, float noiseFactor, float offSet) {
  26.   float sz = noiseFactor*step;
  27.   color f = img.get(int(x), int(y));
  28.   fill(f,100);
  29.   ellipse(x+offSet, y+offSet, sz, sz);
  30. }
  31.  
  32. void draw() {
  33. }
  34.  
  35. void keyPressed() {
  36.   save(random(23232)+".jpg");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement