Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage myImage;
- color col;
- float sz_max = 30;
- float sz_min = sz_max/2;
- int max = 10;
- float alpha = 200;
- void setup() {
- background(255);
- colorMode(HSB);
- noStroke();
- myImage = loadImage("http://media-cache-ec0.pinimg.com/736x/c3/5e/e6/c35ee690c3467e75cd8d607f66357695.jpg");
- size(myImage.width, myImage.height);
- myImage.loadPixels();
- }
- void draw() {
- for (int i=0; i<max; i++) {
- int x = int(random(width));
- int y = int(random(height));
- col = myImage.pixels[y*width+x];
- float d = dist(width/2, height/2, x, y);
- float maxDist = width/1.5;
- float var = map(d, 0, maxDist, 10, 1);
- float sz = map(d, 0, maxDist, sz_max, sz_min);
- float r = random(1, 10);
- if (r < var) {
- fill(col, alpha);
- ellipse(x, y, sz, sz);
- }
- }
- }
- void mouseClicked() {
- sz_max -= 5;
- sz_min = sz_max/2;
- max *= 1.4;
- alpha -=30;
- }
- void keyPressed() {
- save(random(1234)+".png");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement