-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A quick variation on the previous Voronoi sketch. I had the values map inverse those outside. Interestingly, when it comes close to middle grey, it looks like those shapes are on top of the letters. This is because it freely crosses over the bounds of the letters and background as one shape (see Josef Albers, The Interaction of Color).
- Loading branch information
James Lawrence Turner
committed
Feb 3, 2015
1 parent
301c8ff
commit 02aa133
Showing
5 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
class Region { | ||
float x, y, colorNumber; | ||
Region(float x, float y) { | ||
this.x = x; | ||
this.y = y; | ||
this.colorNumber = random(1.0) * noise(x, y); | ||
} | ||
float distanceTo(float x, float y){ | ||
return sqrt(sq(this.x - x) + sq(this.y - y)); | ||
} | ||
} | ||
|
||
ArrayList<Region> regions; | ||
PShape logo; | ||
PGraphics logoMask; | ||
|
||
void setup() { | ||
size(5000,5000); | ||
|
||
logo = loadShape("urx-logo.svg"); | ||
logo.disableStyle(); | ||
logo.scale(width / logo.width); | ||
|
||
logoMask = createGraphics(width, height); | ||
logoMask.beginDraw(); | ||
logoMask.background(0); | ||
logoMask.translate(width / 8, height/4 + height / 16); | ||
logoMask.scale(0.75); | ||
logoMask.fill(255); | ||
logoMask.shape(logo); | ||
logoMask.endDraw(); | ||
|
||
smooth(); | ||
background(color(255)); | ||
regions = new ArrayList<Region>(); | ||
for(int i = 0; i < 500; i++) { | ||
regions.add(new Region(random(width), random(height))); | ||
} | ||
noLoop(); | ||
} | ||
|
||
void draw() { | ||
PGraphics output = createGraphics(width,height); | ||
output.loadPixels(); | ||
for(int y = 0; y < height; y++) { | ||
for(int x = 0; x < width; x++) { | ||
color c; | ||
float distanceToClosestRegion = Float.MAX_VALUE; | ||
Region closestRegion = null; | ||
for(Region r : regions) { | ||
float distance = r.distanceTo(x,y); | ||
if(distance < distanceToClosestRegion) { | ||
closestRegion = r; | ||
distanceToClosestRegion = distance; | ||
} | ||
} | ||
c = color(map(closestRegion.colorNumber, 0.0, 1.0, 255, 0)); | ||
if(logoMask.pixels[y * width + x] == color(255)) { | ||
int variance = round(map(closestRegion.colorNumber, 0.0, 1.0, 0, 255)); | ||
c = color(variance); | ||
} | ||
output.pixels[y * width + x] = c; | ||
} | ||
println(y); | ||
} | ||
output.updatePixels(); | ||
output.save("output.png"); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mode.id=processing.mode.java.JavaMode | ||
mode=Java |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.