Advertisement
xeromino

disco

Aug 2nd, 2014
1,735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. PImage img;
  2. int f, step = 4;
  3.  
  4. void setup() {
  5.   img = loadImage("tmp-0.gif");
  6.   size(img.width, img.height);
  7.   background(0);
  8.   stroke(255);
  9.   colorMode(HSB, 255, 100, 100);
  10.   rectMode(CENTER);
  11.   frameRate(10);
  12. }
  13.  
  14. void draw() {
  15.   if (frameCount==172) noLoop();
  16.   convPic();
  17. }
  18.  
  19. void convPic() {
  20.   background(#000000);
  21.   img = loadImage("tmp-"+((frameCount-1)%172)+".gif");
  22.   for (int x=2; x<width; x += step) {
  23.     for (int y=2; y<height; y+= step) {
  24.       f = (int) map(y, 0, height, 0, 255);
  25.       color col = img.get(x, y);
  26.       if (brightness(col)<80) {
  27.         fill(f, 100, 100);
  28.       } else {
  29.         fill(#2F065A);
  30.       }
  31.       stroke(#000000);
  32.       rect(x, y, step, step);
  33.     }
  34.   }
  35.   saveFrame("image-###.gif");
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement