Advertisement
xeromino

emma

Aug 19th, 2014
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. PImage img;
  2. int min=25, max=125, off=8;
  3.  
  4. void setup() {
  5. img = loadImage("http://media-cache-ak0.pinimg.com/736x/87/d8/c8/87d8c8297b66753d42eb93dc3aaa5698.jpg");
  6. size(img.width, img.height);
  7. image(img,0,0);
  8. }
  9.  
  10.  
  11. void draw() {
  12. int x = (int) random(width);
  13. int y = (int)random(height);
  14. int w = (int)random(min, max);
  15. int h = (int)random(min, max);
  16. int x2 = x + (int)random(-off, off);
  17. int y2 = y + (int)random(-off, off);
  18. PImage temp = createImage(w, h, RGB);
  19. temp.loadPixels();
  20. for (int i=0; i<w; i++) {
  21. for (int j=0; j<h; j++) {
  22. temp.pixels[i+j*w]=img.get(x+i, y+j);
  23. }
  24. }
  25. temp.updatePixels();
  26. //float alpha = map(w*h,min*min,max*max,30,2);
  27. float alpha = map(w*h,min*min,max*max,100,15);
  28. tint(255, alpha);
  29. image(temp,x2,y2);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement