Advertisement
xeromino

sliced

Feb 22nd, 2014
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. PImage img;
  2. int div;
  3.  
  4. void setup() {
  5.   img = loadImage("http://media-cache-ak0.pinimg.com/736x/fb/01/f6/fb01f688101f5023e0745fce0d9651d1.jpg");
  6.   size(img.width, img.height);
  7.  
  8.   int i=0;
  9.   div=5;
  10.  
  11.   int stepx = (int) width/div;
  12.   int stepy = (int) height/div;
  13.  
  14.   for (int x=0; x<width; x += stepx) {
  15.     copy(img, x,0 , stepx, height, x, i*stepy, stepx, height);
  16.     copy(img, x, height-i*stepy,stepx,i*stepy,x,0,stepx,i*stepy);
  17.     i++;
  18.   }
  19. }
  20. void draw() {
  21.  
  22. }
  23.  
  24.  
  25. void keyPressed() {
  26.   save(random(455)+".jpg");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement