Created
April 18, 2011 19:02
-
-
Save inky/925940 to your computer and use it in GitHub Desktop.
Playing with Processing.
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
PFont font; | |
String msg = "HACK THE PLANET"; | |
void setup() | |
{ | |
size(500, 500); | |
background(0, 20, 0); | |
smooth(); | |
font = loadFont("Uni0554-24.vlw"); | |
textFont(font); | |
rectMode(CENTER); | |
textAlign(LEFT); | |
for (int i = 0; i < 100; i++) { | |
pushMatrix(); | |
translate(width/2, height/2); | |
rotate(PI * i * 0.02); | |
// center glow | |
noFill(); | |
stroke(255, 0, 100, 50); | |
line(0, 0, 250, 0); | |
// flowery thing | |
if (i % 10 == 3) { | |
stroke(255, 0, 0, 50); | |
beginShape(); | |
vertex(0, 0); | |
bezierVertex(100, 80, 80, -100, 50, -50); | |
bezierVertex(0, 0, 50, 80, 0, 0); | |
endShape(); | |
} | |
// yellow | |
stroke(255, 150, 0, 50); | |
line(100, -50, 100, 50); | |
// green | |
stroke(100, 255, 0, 100); | |
line(-250, 0, 250, 250); | |
// edges | |
stroke(0, 100, 255, 100); | |
line(-250, 250, 250, 250); | |
popMatrix(); | |
} | |
// hack the planet | |
for (int a = 0; a < 4; a++) { | |
pushMatrix(); | |
translate(width/2, height/2); | |
rotate(PI * a * 0.5 + 0.2); | |
float arclen = 0; | |
float r = 190; | |
for (int i = 0; i < msg.length(); i++) { | |
char c = msg.charAt(i); | |
println(c); | |
float w = textWidth(c); | |
arclen += w/2; | |
float theta = PI + arclen / r; | |
pushMatrix(); | |
translate(r * cos(theta), r * sin(theta)); | |
rotate(theta + PI/2); | |
fill(0, 255, 0, 100); | |
for (int x = -1; x <= 1; x++) { | |
for (int y = -1; y <= 2; y++) { | |
if (x == 0 && y == 0) continue; | |
text(c, x, y); | |
} | |
} | |
fill(0); | |
text(c, 0, 0); | |
popMatrix(); | |
arclen += w/2; | |
} | |
popMatrix(); | |
} | |
save("output.png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment