Advertisement
xeromino

torn

May 14th, 2014
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. float y, theta;
  2. PImage img;
  3. float[] len;
  4.  
  5. void setup() {
  6.   img = loadImage("http://media-cache-ak0.pinimg.com/736x/8b/13/4e/8b134e2309e76aced0bcd9ed3d8bf9cf.jpg");
  7.   size(400, 400);
  8.   background(0);
  9.   noFill();
  10.   strokeCap(SQUARE);
  11.   len = new float[height];
  12.   for (int y=0; y<height;y++) {
  13.     len[y]=random(width/2);
  14.   }
  15. }
  16.  
  17. void draw() {
  18.   image(img, 0, 0);
  19.   for (int y=0; y<height;y++) {
  20.     stroke(get(width/2, y), 255);
  21.     float myX = map(sin(theta+TWO_PI/height*y), -1, 1, 0, len[y]);
  22.     line(width/2, y, width/2-myX, y);  
  23.   }
  24.  
  25.   theta += 0.0523*2;
  26.  
  27.   //if (frameCount%2==0 && frameCount<61) saveFrame("image-###.gif");
  28.  
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement