Advertisement
xeromino

oddone

Feb 1st, 2015
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. int cols=12, rows=8;
  2. int sz = 80;
  3. PImage img1, img2;
  4.  
  5. void setup() {
  6.   img1=loadImage("http://emoji.ink/assets/160x160/416.png");
  7.   img2=img1.get();
  8.   img2.filter(GRAY);
  9.   size(sz*cols, sz*rows);
  10.   createGrid();
  11. }
  12.  
  13. void draw() {
  14. }
  15.  
  16. void mouseReleased() {
  17.   createGrid();
  18. }
  19.  
  20. void keyPressed() {
  21.   save(random(344)+".jpg");
  22. }
  23.  
  24. void createGrid() {
  25.   background(20);
  26.   for (int i=0; i<cols; i++) {
  27.     for (int j=0; j<rows; j++) {
  28.       if (random(1)>.99) {
  29.         image(img2, i*sz, j*sz, sz, sz);
  30.       } else {
  31.         image(img1, i*sz, j*sz, sz, sz);
  32.       }
  33.     }
  34.   }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement