Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- int min=25, max=125, off=8;
- void setup() {
- img = loadImage("http://media-cache-ak0.pinimg.com/736x/87/d8/c8/87d8c8297b66753d42eb93dc3aaa5698.jpg");
- size(img.width, img.height);
- image(img,0,0);
- }
- void draw() {
- int x = (int) random(width);
- int y = (int)random(height);
- int w = (int)random(min, max);
- int h = (int)random(min, max);
- int x2 = x + (int)random(-off, off);
- int y2 = y + (int)random(-off, off);
- PImage temp = createImage(w, h, RGB);
- temp.loadPixels();
- for (int i=0; i<w; i++) {
- for (int j=0; j<h; j++) {
- temp.pixels[i+j*w]=img.get(x+i, y+j);
- }
- }
- temp.updatePixels();
- //float alpha = map(w*h,min*min,max*max,30,2);
- float alpha = map(w*h,min*min,max*max,100,15);
- tint(255, alpha);
- image(temp,x2,y2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement