Advertisement
xeromino

silly

Nov 19th, 2014
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. PImage img;
  2. int sc = 7; //scale factor
  3.  
  4. void setup() {
  5. img = loadImage("1.jpg");
  6. size(485, 385);
  7. doStuff();
  8. }
  9.  
  10. void draw() {
  11. doStuff();
  12. if (frameCount<30) saveFrame("image-###.gif");
  13. }
  14.  
  15. void mouseClicked() {
  16. doStuff();
  17. }
  18.  
  19. void keyPressed() {
  20. save(random(100)+".jpg");
  21. }
  22.  
  23. void doStuff() {
  24. background(255);
  25. int w = img.width/sc;
  26. int h = img.height/sc;
  27. for (int x=int (w*.1); x<width-w; x += int (w*1.1)) {
  28. for (int y=int (h*.1); y<height-h; y += int (h*1.1)) {
  29. PImage temp = createImage(w, h, RGB);
  30. temp.copy(img, 0, 0, img.width, img.height, 0, 0, w, h);
  31. tint(random(256), random(256), random(256),240);
  32. image(temp, x, y);
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement