Advertisement
xeromino

bounce

Mar 11th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. PImage img;
  2. int slices = 10;
  3. float unit, theta;
  4.  
  5. void setup() {
  6.   img = loadImage("pic1.jpg");
  7.   size(img.width, img.height);
  8.   unit=height/slices;
  9. }
  10.  
  11. void draw() {
  12.   image(img, 0, 0);
  13.   for (int i=0; i<slices; i++) {
  14.     float scal = map(sin(theta),-1,1,1,1.3);
  15.     int y = int(i*unit);
  16.     copy(img,0,y,width,int(unit),0,y,width, int(unit*scal));  
  17.   }
  18.   theta += TWO_PI/slices;
  19.  
  20.   //if (frameCount<11) saveFrame("image-####.gif");
  21.    
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement