Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int cols=12, rows=8;
- int sz = 80;
- PImage img1, img2;
- void setup() {
- img1=loadImage("http://emoji.ink/assets/160x160/416.png");
- img2=img1.get();
- img2.filter(GRAY);
- size(sz*cols, sz*rows);
- createGrid();
- }
- void draw() {
- }
- void mouseReleased() {
- createGrid();
- }
- void keyPressed() {
- save(random(344)+".jpg");
- }
- void createGrid() {
- background(20);
- for (int i=0; i<cols; i++) {
- for (int j=0; j<rows; j++) {
- if (random(1)>.99) {
- image(img2, i*sz, j*sz, sz, sz);
- } else {
- image(img1, i*sz, j*sz, sz, sz);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement