Skip to content

Instantly share code, notes, and snippets.

@errete
Created April 9, 2014 14:21
Show Gist options
  • Save errete/10276119 to your computer and use it in GitHub Desktop.
Save errete/10276119 to your computer and use it in GitHub Desktop.
Processing.org code for the cover of http://8tracks.com/danielrt/42
int i, j, k, gray;
PGraphics n42; // raster "42."
PFont fnt=createFont("HelveticaNeueLTStd-Bd", 54);
color[] c={
color(234, 38, 92), // red
color(5, 130, 204), // blue
color(144, 204, 0), // green
color(254, 183, 0) // orange
};
void setup() {
size(1440, 1440);
background(255);
noFill();
n42=createGraphics(90, 90); // raster "42."
n42.beginDraw();
n42.background(0);
n42.fill(255);
n42.textFont(fnt);
n42.textAlign(CENTER, TOP);
n42.text("42.", 45, 40);
n42.endDraw();
strokeWeight(1);
strokeCap(SQUARE);
for (j=0; j<90; j++) {
stroke(c[floor(random(c.length))], 63+floor(random(63)));
for (i=0; i<90; i++) {
gray=8-round(red(n42.pixels[i+j*n42.width])/32);
for(k=0; k<8+gray; k++) {
line(i*16, j*16+k, i*16+16, j*16+k);
}
}
stroke(c[floor(random(c.length))], 63+floor(random(63)));
for (i=0; i<90; i++) {
gray=8-round(red(n42.pixels[i+j*n42.width])/32);
for(k=16; k>=8-gray; k--) {
line(i*16, j*16+k, i*16+16, j*16+k);
}
}
}
save("42.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment