Skip to content

Instantly share code, notes, and snippets.

@errete
Created March 16, 2014 15:58
Show Gist options
  • Save errete/9585335 to your computer and use it in GitHub Desktop.
Save errete/9585335 to your computer and use it in GitHub Desktop.
Processing.org code for the cover of http://8tracks.com/danielrt/40
int i, j, gray;
PGraphics n40; // raster "40."
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);
noStroke();
n40=createGraphics(90, 90); // raster "38."
n40.beginDraw();
n40.background(0);
n40.fill(255);
n40.textFont(fnt);
n40.textAlign(CENTER, TOP);
n40.text("40.", 45, 40);
n40.endDraw();
for (i=0; i<90; i++) {
for (j=0; j<90; j++) {
gray=round(red(n40.pixels[i+j*n40.width])/32);
fill(c[round(random(c.length-1))], round(random(192))+63);
quad(
i*16+(j%2),
j*16-16+gray,
i*16-16+gray,
j*16,
i*16,
j*16+16-gray,
i*16+16-gray,
j*16
);
}
}
save("40.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment