Advertisement
xeromino

abstract

Nov 9th, 2014
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. PImage img;
  2. float x, y;
  3.  
  4. void setup() {
  5.   img = loadImage("http://media-cache-ak0.pinimg.com/736x/7e/db/9f/7edb9f5c166f9d53e3a7c05356f65177.jpg");
  6.   size(img.width, img.height);
  7.   noStroke();
  8.   background(255);
  9. }
  10.  
  11. void draw() {
  12.   x = random(width);
  13.   y = random(height);
  14.   color col = img.get(int(x), int(y));
  15.   pushMatrix();
  16.   translate(x, y);
  17.   rotate(random(PI));
  18.   float sz1 = 50;
  19.   float sz2 = 300;
  20.   float sz = random(sz1, sz2);
  21.   float alpha1 = map(sz, sz1, sz2, 50, 20);
  22.   float alpha2 = map(brightness(col), 0, 255, 50, 0);
  23.   float alpha = alpha1+alpha2;
  24.   fill(col, alpha);
  25.   rect(0, 0, sz, sz);
  26.   popMatrix();
  27. }
  28.  
  29. void keyPressed() {
  30.   save(random(999999)+".jpg");
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement