Created
January 17, 2014 20:37
-
-
Save errete/8480950 to your computer and use it in GitHub Desktop.
code for the cover of http://8tracks.com/danielrt/35
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
int i, j, k; | |
float[] disp=new float[2]; // [0] = x displacement; [1] = y displacement | |
color[] c={ | |
color(115, 221, 191), | |
color(184, 222, 83), | |
color(100, 193, 81), | |
color(21, 126, 77), | |
color(70, 69, 67) | |
}; | |
PGraphics n35; // raster "35" | |
int gray; // color of current pixel | |
PFont fnt=createFont("HelveticaNeue-Bold", 54); | |
void setup() { | |
size(1440, 1440); | |
background(c[4]); | |
// creating the raster "35." | |
n35=createGraphics(90, 90); | |
n35.beginDraw(); | |
n35.background(255); | |
n35.fill(0); | |
n35.textFont(fnt); | |
n35.textAlign(CENTER, TOP); | |
n35.text("35.", 45, 26); | |
n35.endDraw(); | |
strokeWeight(8); | |
for (i=0; i<90; i++) { | |
for (j=0; j<90; j++) { | |
disp[0]=i-45; | |
disp[1]=j-45; | |
gray=round(red(n35.pixels[i+j*n35.width])/12); | |
stroke(c[(floor(random(4)))], 127); | |
line(i*16, j*16, i*16+disp[0]/45*6*gray, j*16+disp[1]/45*6*gray); | |
} | |
} | |
// uncomment the next line to save | |
// save("portada_35.png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment