Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- int step = 10, num=10;
- void setup() {
- img=loadImage("http://media-cache-ak0.pinimg.com/736x/3a/0f/c5/3a0fc551cf2ff049aa6874f5ef10b2a7.jpg");
- size(img.width, img.height);
- background(0);
- noStroke();
- float xstart = random(10);
- float xnoise = xstart;
- float ynoise = random(10);
- for (int i=0; i<num; i++) {
- float offSet = random(-step/2, step/2);
- for (int y=0; y<height; y+=step) {
- xnoise = xstart;
- ynoise += .1;
- for (int x=0; x<width; x+=step) {
- xnoise += .1;
- drawPoint(x, y, noise(xnoise, ynoise), offSet);
- }
- }
- }
- }
- void drawPoint(float x, float y, float noiseFactor, float offSet) {
- float sz = noiseFactor*step;
- color f = img.get(int(x), int(y));
- fill(f,100);
- ellipse(x+offSet, y+offSet, sz, sz);
- }
- void draw() {
- }
- void keyPressed() {
- save(random(23232)+".jpg");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement