Skip to content
Newer
Older
100644 58 lines (49 sloc) 1.21 KB
c890dea @potatono More routines
potatono authored May 27, 2012
1 class VerticalGreetz extends Routine {
2 int FONT_SIZE = 16;
3 PFont font;
4 String messages[] = new String[] {
5 "DISORIENT"//,
6 // "KOSTUME KULT",
7 // "BLACK LIGHT BALL"
8 // "COUNTRY CLUB"
9 };
10 String message = "DISORIENT";
11 PGraphics buffer;
12 int bufferWidth;
13 int bufferHeight;
14 int w;
ce1845d Refactored to use Config class
Justin Day authored Jun 16, 2014
15 int x;
c890dea @potatono More routines
potatono authored May 27, 2012
16
17 void setup(PApplet parent) {
18 super.setup(parent);
ce1845d Refactored to use Config class
Justin Day authored Jun 17, 2014
19 w = bufferWidth = Config.HEIGHT;
20 bufferHeight = Config.WIDTH;
c890dea @potatono More routines
potatono authored May 27, 2012
21
22 buffer = createGraphics(bufferWidth,bufferHeight,JAVA2D);
23 font = loadFont("Disorient-" + FONT_SIZE + ".vlw");
24 buffer.textFont(font, FONT_SIZE);
25 buffer.textMode(MODEL);
26 }
27
28 void draw() {
29 buffer.beginDraw();
30 buffer.background(0);
31
32 if (w == 0) {
ce1845d Refactored to use Config class
Justin Day authored Jun 17, 2014
33 w = -int((message.length()-1) * (FONT_SIZE*1.35) + Config.WIDTH);
c890dea @potatono More routines
potatono authored May 27, 2012
34 }
35
36 buffer.fill(255,128,64);
37 buffer.text(message, x, FONT_SIZE+5);
38 buffer.endDraw();
39
40 pushMatrix();
ce1845d Refactored to use Config class
Justin Day authored Jun 17, 2014
41 draw.rotate(-HALF_PI);
42 draw.translate(0,-Config.WIDTH);
43 draw.image(buffer,0,0);
c890dea @potatono More routines
potatono authored May 27, 2012
44 popMatrix();
45
46 if (frameCount % 2 == 0) {
47 x = x - 1;
48 }
49
50 if (x<w) {
51 x = bufferWidth;
52 message = messages[int(random(messages.length))];
53 w = 0;
54 newMode();
55 }
56 }
57 }
Something went wrong with that request. Please try again.