Advertisement
xeromino

lightdark

Oct 23rd, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. PImage img;
  2.  
  3. void setup() {
  4.   size(540, 540);
  5.   colorMode(HSB);
  6.   //img = loadImage("https://s-media-cache-ak0.pinimg.com/474x/31/45/56/31455645924b80eb861fb9f55b7dfa1d.jpg");
  7.   img = loadImage("pic.JPG");
  8.   img.filter(GRAY);
  9.   image(img, 0, 0, width, height);
  10. }
  11.  
  12. void draw() {
  13.   blurNoise();
  14.   if (frameCount%4==0 && frameCount<=280) saveFrame("/Volumes/Anim/image-###.gif");
  15.   //println(frameCount);
  16. }
  17.  
  18. void blurNoise() {
  19.   filter(BLUR, 0.6);
  20.   loadPixels();
  21.   for (int i = 0; i<pixels.length; i++) {
  22.     float b = brightness(pixels[i]);
  23.     float newB = b+noise(i*0.01, frameCount*0.03)*10;
  24.     float s = saturation(pixels[i]);
  25.     float h = hue(pixels[i]);
  26.  
  27.     if (b > 150) {
  28.       pixels[i] = color(h, s, newB);
  29.     }
  30.   }
  31.   updatePixels();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement