Advertisement
xeromino

pix

Jun 20th, 2014
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. PImage img;
  2. int num = 30;
  3. float y, sz;
  4.  
  5. void setup() {
  6.   img = loadImage("photo.jpg");
  7.   size(img.width, img.height);
  8.   image(img, 0, 0);
  9.   frameRate(15);
  10.   sz=width/float(num);
  11. }
  12.  
  13. void draw() {
  14.   for (int i=0; i<num+1; i++) {
  15.     float x = sz*i;
  16.     color f = img.get(int(x), int(y));
  17.     fill(f, 150);
  18.     noStroke();
  19.     rect(x, random(height), sz, sz*2);
  20.     if (y>height) y=0;
  21.   }
  22.   y++;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement