Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- int step=25, num=5, counter;
- void setup() {
- img = loadImage("http://www.cnsnews.com/sites/default/files/images/freeman%20%202_1.jpg");
- size(img.width, img.height);
- colorMode(HSB, 360, 100, 100);
- background(#eeeeee);
- noStroke();
- for (int y=step/2; y<height; y+=step) {
- for (int x=step/2; x<width-step; x+=step) {
- float offSet=counter%2==0?0:step/2;
- for (int i=0; i<num; i++) {
- float dv = map(i, 0, num-1, -3, 3);
- float sz = map(i, 0, num, step*1.2, step/2);
- color col = img.get(int(x+dv+offSet), int(y+dv));
- float h = hue(col);
- float s = saturation(col);
- float b = brightness(col);
- fill(h, s, b);
- float scal=map(b, 0, 255, 1, 0);
- ellipse(x+offSet, y, sz*scal, sz*scal);
- }
- }
- counter++;
- }
- }
- void draw() {
- }
- void keyPressed() {
- save(random(3234)+".jpg");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement