Advertisement
xeromino

john

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