Advertisement
xeromino

rift

Apr 30th, 2014
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. PImage img, img2;
  2. float theta, val=25;
  3.  
  4. void setup() {
  5.   img = loadImage("http://media-cache-ak0.pinimg.com/736x/29/61/6a/29616ab98f10a5363606f3c5970fd72f.jpg");
  6.   img2 = loadImage("http://media-cache-ec0.pinimg.com/736x/3d/a1/13/3da1137e089fbf3b58ddd88393cd3eb9.jpg");
  7.   size(500, 500);
  8. }
  9.  
  10. void draw() {
  11.  
  12.   image(img, 0, 0);
  13.   colorMode(HSB, 100);
  14.   loadPixels();
  15.  
  16.   val = map(sin(theta),-1,1,10,50);
  17.  
  18.   for (int x=0; x<width; x++) {
  19.     for (int y = 0; y<height; y++) {
  20.       float b = brightness(img.get(x, y));
  21.       if (b > 100-val) {
  22.         int i = y*width+x;
  23.         pixels[i] = img2.get(x, y);
  24.       }
  25.     }
  26.   }
  27.   updatePixels();
  28.  
  29.   theta += (PI/10);
  30.  
  31.   //if (theta < PI*1.05) saveFrame("image-###.gif");
  32.  
  33. }
  34.  
  35. void keyPressed() {
  36.   saveFrame("image-####.gif");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement