Advertisement
xeromino

sketchy

Apr 6th, 2015
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. PImage img;
  2.  
  3. void setup() {
  4.   img = loadImage("https://s-media-cache-ak0.pinimg.com/736x/ad/3d/85/ad3d8563a5758db9fb79980cd4f9df40.jpg");
  5.   size(img.width, img.height);
  6.   noStroke();
  7.   strokeWeight(2);
  8.   background(255);
  9.   for (int i=0; i<150000; i++) {
  10.     float x = random(width);
  11.     float y = random(height);
  12.     color c = img.get(int(x), int(y));
  13.     if (brightness(c)<=100) {
  14.       stroke(0, 60);
  15.       pushMatrix();
  16.       translate(x, y);
  17.       rotate(random(PI));
  18.       line(-5, 0, 5, 0);
  19.       popMatrix();
  20.     }
  21.     if (brightness(c)>100 && brightness(c)<150) {
  22.       if (random(1)>.3) {
  23.         stroke(0, 25);
  24.         pushMatrix();
  25.         translate(x, y);
  26.         rotate(random(PI));
  27.         line(-5, 0, 5, 0);
  28.         popMatrix();
  29.       }
  30.     }
  31.   }
  32. }
  33.  
  34. void draw() {
  35. }
  36.  
  37. void keyPressed(){
  38.   save(random(3434)+".jpg");
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement