Advertisement
xeromino

jm2

May 18th, 2014
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. PImage img;
  2. int div=40, i=0, stepx, stepy;
  3. float theta;
  4.  
  5. void setup() {
  6.   img = loadImage("john.jpg");
  7.   size(img.width, img.height);
  8.   stepx = (int) width/div;
  9.   frameRate(10);
  10. }
  11. void draw() {
  12.   for (int x=0; x<width; x += stepx) {
  13.     float offSet = PI/div*i;
  14.     int h =(int) map(sin(theta+offSet), -1, 1, 0, height);
  15.     int y =(int) map(sin(theta+offSet), -1, 1, 0, height);
  16.     copy(img, x, height-y, stepx, y, x, 0, stepx, y);
  17.     copy(img, x, 0, stepx, height-y, x, y, stepx, height-y);
  18.     i++;
  19.   }
  20.   theta += (TWO_PI/30);
  21.  
  22.   //if (theta<TWO_PI) saveFrame("image-###.gif");
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement