Advertisement
xeromino

stirred

Dec 21st, 2014
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1. PImage img;
  2. int step;
  3.  
  4. void setup() {
  5.   img = loadImage("http://media-cache-ec0.pinimg.com/736x/09/a4/d5/09a4d59938e39d9a11eeea6c5d8a0306.jpg");
  6.   size(img.width, img.height);
  7.   imageMode(CENTER);
  8.   doStuff();
  9. }
  10.  
  11. void draw() {
  12.   //doStuff();
  13.   //if (frameCount<40) saveFrame("image-###.gif");
  14. }
  15.  
  16. void mouseReleased() {
  17.   doStuff();
  18. }
  19.  
  20. void doStuff() {
  21.   background(20);
  22.   int c = 0;
  23.   step = int(random(40, 80));
  24.   for (int y=0; y<height; y+=step) {
  25.     int p = 0;
  26.     int r1=15, r2=30;
  27.     step = int(random(40, 80));
  28.     int start = y-int(random(r1, r2)) ;
  29.     int end = y+step+int(random(r1, r2));
  30.     PImage temp = createImage(width, end-start, RGB);
  31.     for (int py=start; py<end; py++) {
  32.       for (int x=0; x<width; x++) {
  33.         temp.pixels[p]=img.get(x, py);
  34.         p++;
  35.       }
  36.     }
  37.     pushMatrix();
  38.     translate(width/2, y+step/2);
  39.     float r = 10;
  40.     float rot = random(-radians(r), radians(r));
  41.     rotate(rot);
  42.     if (c%2==0) {
  43.       tint(#DE7474);
  44.     } else {
  45.       noTint();
  46.     }
  47.     image(temp, 0, 0);
  48.     popMatrix();
  49.     c++;
  50.   }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement