Advertisement
xeromino

warped

Mar 31st, 2015
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. // based upon: http://www.openprocessing.org/sketch/191377
  2.  
  3. PImage foto;
  4. int fx = 296, fy = 254, frames = 60, d=100;
  5. float theta;
  6.  
  7. void setup() {      
  8.   frameRate(10);
  9.   foto = loadImage("jb.jpg");
  10.   size(foto.width, foto.height);
  11. }
  12.  
  13. void draw() {            
  14.   int mx = int(width*.6+sin(theta)*width*.2);  
  15.   int my = int(height/2+cos(theta)*height*.2);
  16.   copy(foto, 0,0,   fx, fy,                        0,0,   mx, my);              // alto sinistra
  17.   copy(foto, fx,0,  foto.width-fx, fy,             mx,0,  width-mx, my);        // alto destra
  18.   copy(foto, 0,fy,  fx, foto.height-fy,            0,my,  mx, height-my);       // basso sinistra
  19.   copy(foto, fx,fy, foto.width-fx, foto.height-fy, mx,my, width-mx, height-my); // basso destra  
  20.  
  21.   theta += TWO_PI/frames;
  22.   if (frameCount<=frames) saveFrame("image-###.gif");
  23.  
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement