Skip to content

Instantly share code, notes, and snippets.

@riebschlager
Created July 11, 2014 02:38
Show Gist options
  • Save riebschlager/bc8639d2424cc3d3758f to your computer and use it in GitHub Desktop.
Save riebschlager/bc8639d2424cc3d3758f to your computer and use it in GitHub Desktop.
PImage src;
int circleWidth = 13;
void setup() {
size(displayWidth, displayHeight);
background(0);
noStroke();
src = loadImage("src/UnionSta-KC Skyline.jpg");
//src.resize(width, height);
int circlesH = floor(width / circleWidth);
int circlesV = floor(height / circleWidth);
ArrayList<PVector> points = new ArrayList<PVector>();
for (int ix = 0; ix < circlesH; ix++) {
for (int iy = 0; iy < circlesV; iy++) {
float centerX = ix * circleWidth + circleWidth / 2;
float centerY = iy * circleWidth + circleWidth / 2;
points.add(new PVector(centerX, centerY));
}
}
for (int j = 0; j < 5000; j++) {
PVector randomPoint = points.get(floor(random(points.size())));
float centerX = randomPoint.x;
float centerY = randomPoint.y;
float multiplier = random(5, 10);
for (int i = 0; i < circleWidth; i++) {
int pixel = src.get(floor(centerX), floor(centerY - i / 2));
fill(pixel);
ellipse(centerX, centerY, (circleWidth - i) * multiplier, (circleWidth - i) * multiplier);
}
}
for (int ix = 0; ix < circlesH; ix++) {
for (int iy = 0; iy < circlesV; iy++) {
noStroke();
ellipseMode(CENTER);
float centerX = ix * circleWidth + circleWidth / 2;
float centerY = iy * circleWidth + circleWidth / 2;
for (int i = 0; i < circleWidth; i+=3) {
int pixel = src.get(floor(centerX), floor(centerY - i / 2));
fill(pixel);
ellipse(centerX, centerY, (circleWidth - i), (circleWidth - i));
}
}
}
int randomName = floor(random(10000));
save("kc/output-" + randomName + ".png");
}
void draw() {
//
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment