Skip to content

Instantly share code, notes, and snippets.

@errete
Created December 21, 2013 15:38
Show Gist options
  • Save errete/8070920 to your computer and use it in GitHub Desktop.
Save errete/8070920 to your computer and use it in GitHub Desktop.
int i, j, x; // loops
color[] c={
color(234, 38, 92), // red
color(5, 130, 204), // blue
color(144, 204, 0), // green
color(254, 183, 0) // orange
};
PGraphics n34; // raster "33"
int gray; // color of current pixel
PFont fnt=createFont("HelveticaNeue-Bold", 54);
void setup() {
size(1440, 1440);
background(255);
// creating the raster "34."
n34=createGraphics(90, 90);
n34.beginDraw();
n34.background(255);
n34.fill(0);
n34.textFont(fnt);
n34.textAlign(CENTER, TOP);
n34.text("34.", 45, 26);
n34.endDraw();
noStroke();
for (i=0; i<90; i++) {
x=floor(random(8));
for (j=0; j<90; j++) {
gray=12-round(red(n34.pixels[i+j*n34.width])/12);
fill(c[floor(random(c.length))], 64+floor(random(192)));
rect(
i*16,
j*16+x,
gray+16,
gray+16
);
}
}
save("34.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment