Permalink
Browse files

Refactored everything into separate classes.

Other various fixes.
  • Loading branch information...
1 parent 9adb298 commit a6b64d89485744e7e516a526fdf78ef9cbbe026c @potatono potatono committed May 16, 2012
Showing with 603 additions and 757 deletions.
  1. +40 −0 Burst.pde
  2. +31 −0 Bursts.pde
  3. +6 −2 Dacwes.pde
  4. +17 −0 Flash.pde
  5. +19 −0 FlashColors.pde
  6. +33 −0 FollowMouse.pde
  7. +48 −0 Greetz.pde
  8. +18 −0 Lines.pde
  9. +18 −0 OppositeLines.pde
  10. +16 −0 RGB.pde
  11. +32 −0 RadialStar.pde
  12. +25 −0 RadialStars.pde
  13. +15 −0 Routine.pde
  14. +29 −0 Star.pde
  15. +26 −0 Stars.pde
  16. +36 −0 Target.pde
  17. +19 −0 TargetScanner.pde
  18. +27 −0 Waterfall.pde
  19. +27 −0 Waterfalls.pde
  20. +56 −0 Wave.pde
  21. +32 −0 Waves.pde
  22. +33 −755 domeTransmitter.pde
View
@@ -0,0 +1,40 @@
+class Burst {
+ float x;
+ float y;
+ float d;
+ float maxd;
+ float speed;
+ int intensity;
+
+ public Burst()
+ {
+ init();
+ }
+
+ public void init()
+ {
+ x = random(WIDTH);
+ y = random(HEIGHT);
+ maxd = random(10);
+ speed = random(5)/10 + 0.1;
+ d = 0;
+ intensity = 255;
+ }
+
+ public void draw(boolean fl)
+ {
+ if (fl)
+ fill(0);
+ else
+ noFill();
+ stroke(intensity);
+ ellipse(x, y, d, d);
+ d+= speed;
+ if (d > maxd)
+ intensity -= 15;
+
+ if (intensity <= 0)
+ init();
+ }
+}
+
View
@@ -0,0 +1,31 @@
+class Bursts extends Routine {
+ int NUMBER_OF_BURSTS = 4;
+ Burst[] bursts;
+ boolean burst_fill = false;
+
+ void setup(PApplet parent) {
+ super.setup(parent);
+ bursts = new Burst[NUMBER_OF_BURSTS];
+ for (int i = 0; i<NUMBER_OF_BURSTS; i++) {
+ bursts[i] = new Burst();
+ }
+ }
+
+ void reset() {
+ burst_fill = boolean(int(random(1)+0.5));
+ }
+
+ void draw()
+ {
+ // background(0);
+
+ for (int i=0; i<NUMBER_OF_BURSTS; i++) {
+ bursts[i].draw(burst_fill);
+ }
+
+ if (frameCount - modeFrameStart > FRAMERATE*TYPICAL_MODE_TIME) {
+ newMode();
+ }
+ }
+}
+
View
@@ -97,6 +97,7 @@ public class Dacwes {
udp.send(modeBuffer,address,port);
}
+ int maxSentByte = 0;
public void sendData() {
PImage image = get();
@@ -105,7 +106,8 @@ public class Dacwes {
// }
image.loadPixels();
-
+ loadPixels();
+
int r;
int g;
int b;
@@ -120,9 +122,11 @@ public class Dacwes {
buffer[(getAddress(x,y)*3)+1] = byte(r);
buffer[(getAddress(x,y)*3)+2] = byte(g);
buffer[(getAddress(x,y)*3)+3] = byte(b);
+
+
}
}
-
+ updatePixels();
udp.send(buffer,address,port);
}
}
View
@@ -0,0 +1,17 @@
+class Flash extends Routine {
+ void draw() {
+ long frame = frameCount - modeFrameStart;
+
+ if (frame % (2) < 1) {
+ background(255,0,0);
+ }
+ else {
+ background(0,255,255);
+ }
+
+ if (frame > FRAMERATE*TYPICAL_MODE_TIME) {
+ newMode();
+ }
+ }
+
+}
View
@@ -0,0 +1,19 @@
+class FlashColors extends Routine {
+ void draw() {
+ long frame = frameCount - modeFrameStart;
+
+ // print(mouseY*255.0/height);
+ // print(" ");
+
+ colorMode(HSB, 100);
+
+ for(int x = 0; x < width; x++) {
+ for(int y = 0; y < height; y++) {
+ stroke((x*y+frame*4)%100,90,90);
+ point(x,y);
+ }
+ }
+
+ colorMode(RGB, 255);
+ }
+}
View
@@ -0,0 +1,33 @@
+class FollowMouse extends Routine {
+ int color_angle = 0;
+
+ void draw() {
+ background(0);
+
+ for (int row = 0; row < height; row++) {
+ for (int col = 0; col < width; col++) {
+ if(col > mouseX && row > mouseY) {
+ stroke(255,0,0);
+ }
+ else if(col > mouseX && row < mouseY) {
+ stroke(0,255,0);
+ }
+ else if(col < mouseX && row > mouseY) {
+ stroke(0,0,255);
+ }
+ else if(col < mouseX && row < mouseY) {
+ stroke(0,0,0);
+ }
+ else {
+ stroke(255,255,255);
+ }
+ // stroke(0,0,2*((row+col+color_angle)%128));
+ point(col,row);
+ }
+ }
+
+ color_angle = (color_angle+1)%255;
+ }
+
+
+}
View
@@ -0,0 +1,48 @@
+class Greetz extends Routine {
+ int FONT_SIZE = 16;
+ PFont font;
+ String messages[] = new String[] {
+ "DISORIENT"//,
+ // "KOSTUME KULT",
+ // "BLACK LIGHT BALL"
+ // "COUNTRY CLUB"
+ };
+ String message = "DISORIENT";
+
+ void setup(PApplet parent) {
+ super.setup(parent);
+ font = loadFont("Disorient-" + FONT_SIZE + ".vlw");
+ textFont(font, FONT_SIZE);
+ textMode(MODEL);
+ }
+
+ void draw() {
+ background(0);
+ fill(255);
+
+ if (w == 0) {
+ w = -int((message.length()-1) * (FONT_SIZE*1.35) + WIDTH);
+ }
+
+ fill(255,128,64);
+ pushMatrix();
+ rotate(HALF_PI);
+ text(message, x, 0);
+ popMatrix();
+
+ PImage i = get(0,40-FONT_SIZE,WIDTH,FONT_SIZE);
+ i.resize(WIDTH,FONT_SIZE*6);
+ image(i,0,40-FONT_SIZE);
+
+ if (frameCount % 2 == 0) {
+ x = x - 1;
+ }
+
+ if (x<w) {
+ x = HEIGHT;
+ message = messages[int(random(messages.length))];
+ w = 0;
+ newMode();
+ }
+ }
+}
View
@@ -0,0 +1,18 @@
+class Lines extends Routine {
+ void draw() {
+ background(0);
+ stroke(255);
+
+ long frame = frameCount - modeFrameStart;
+ int x = int(frame % 5);
+
+ for (int i = -x; i<WIDTH; i+=5) {
+ line(i, 0, i+8, 8);
+ }
+
+ if (frame > FRAMERATE*TYPICAL_MODE_TIME) {
+ newMode();
+ }
+ }
+
+}
View
@@ -0,0 +1,18 @@
+class OppositeLines extends Routine {
+ void draw() {
+ background(0);
+ stroke(255);
+
+ long frame = frameCount - modeFrameStart;
+ int x = int(frame % 5);
+
+ for (int i = x-5; i<WIDTH; i+=5) {
+ line(i+8, 0, i, 8);
+ }
+
+ if (frame > FRAMERATE*5) {
+ newMode();
+ }
+ }
+
+}
View
16 RGB.pde
@@ -0,0 +1,16 @@
+class RGBRoutine extends Routine {
+ int color_angle = 0;
+
+ void draw() {
+ background(0);
+
+ for (int row = 0; row < height; row++) {
+ for (int col = 0; col < width; col++) {
+ stroke(0,2*((row+col+color_angle)%128),0);
+ point(col,row);
+ }
+ }
+
+ color_angle = (color_angle+1)%255;
+ }
+}
View
@@ -0,0 +1,32 @@
+class RadialStar {
+ float x;
+ float y;
+ float theta;
+ float v;
+
+ public RadialStar() {
+ this.reset();
+ }
+
+ public void draw() {
+ x = x + (v * cos(theta));
+ y = y + (v * sin(theta));
+
+ noStroke();
+ fill(255);
+ rect(x, y, 1, 1);
+
+ if ((x > WIDTH || x < 0) || (y > HEIGHT || y < 0)) this.reset();
+
+ }
+
+ public void reset() {
+ x = 7;
+ y = 7;
+ theta = random(0, 2 * PI);
+ v = random(0.05, 1);
+ }
+
+}
+
+
View
@@ -0,0 +1,25 @@
+class RadialStars extends Routine {
+ int NUMBER_OF_STARS = 30;
+ RadialStar[] radialStars;
+
+ void setup(PApplet parent) {
+ super.setup(parent);
+ radialStars = new RadialStar[NUMBER_OF_STARS];
+ for (int i=0; i<NUMBER_OF_STARS; i++) {
+ radialStars[i] = new RadialStar();
+ }
+ }
+
+ void draw() {
+ background(0);
+
+ for (int i=0; i<NUMBER_OF_STARS; i++) {
+ radialStars[i].draw();
+ }
+
+ if (frameCount - modeFrameStart > FRAMERATE*TYPICAL_MODE_TIME) {
+ newMode();
+ }
+ }
+}
+
View
@@ -0,0 +1,15 @@
+class Routine {
+ PApplet parent;
+ public boolean isDone = false;
+
+ void setup(PApplet parent) {
+ this.parent = parent;
+ }
+
+ void reset() {}
+ void draw() {}
+ void newmode() {
+ isDone = true;
+ }
+}
+
View
@@ -0,0 +1,29 @@
+class Star {
+ float x;
+ float y;
+ int z;
+ float s;
+
+ public Star(float s) {
+ this.s = s;
+ this.reset();
+ }
+
+ public void draw() {
+ x = x + s;
+ if (x>WIDTH*ZOOM)
+ this.reset();
+
+ noStroke();
+ fill(z);
+ rect(x, y, ZOOM, ZOOM);
+ }
+
+ public void reset() {
+ x = -random(WIDTH*ZOOM);
+ y = random(HEIGHT*ZOOM);
+ //s = random(ZOOM)+1;
+ z = int(s/ZOOM*255);
+ }
+}
+
Oops, something went wrong.

0 comments on commit a6b64d8

Please sign in to comment.