Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage tmp;
- PImage[] img = new PImage[2];
- int x, y, w, h, r=100, r2=100;
- int num = int(map(r2,0,100,10000,2000));
- void setup() {
- img[0] = loadImage("3.jpg");
- img[1] = loadImage("4.jpg");
- size(img[0].width, img[0].height);
- initStuff();
- }
- void draw() {
- }
- void mouseReleased() {
- background(255);
- initStuff();
- }
- void keyPressed() {
- save(num+".jpg");
- }
- void doStuff(int v, float v1, float v2) {
- w = (int) random(r2, 3*r2);
- h = (int) random(r2, 3*r2);
- x = (int) random(v1, v2-w);
- y = (int) random(height-h);
- tmp = createImage(w, h, RGB);
- tmp.loadPixels();
- int c=0;
- for (int j=0; j<h; j++) {
- for (int i=0; i<w; i++) {
- tmp.pixels[c] = img[v].get(x+i, y+j);
- c++;
- }
- }
- tint(255, 100);
- image(tmp, x+random(-r, r), y+random(-r, r));
- }
- void initStuff() {
- for (int i=0; i<num; i++) {
- doStuff(0, 0, width/2);
- doStuff(1, width/2, width);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement