Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

Conflicts:
	acw.pde
  • Loading branch information...
2 parents 5582fba + 0cd5707 commit 41cc590d3d9dae014ad712873a080c6972095a9b @potatono potatono committed May 23, 2012
Showing with 1,164 additions and 738 deletions.
  1. BIN .DS_Store
  2. +1 −0 .gitignore
  3. +40 −0 Burst.pde
  4. +31 −0 Bursts.pde
  5. +29 −0 CrawlTest.pde
  6. +34 −10 Dacwes.pde
  7. +39 −0 FFT.pde
  8. +17 −0 Flash.pde
  9. +19 −0 FlashColors.pde
  10. +43 −0 FollowMouse.pde
  11. +52 −0 Greetz.pde
  12. +18 −0 Lines.pde
  13. +60 −0 NightSky.pde
  14. +33 −0 NightStar.pde
  15. +18 −0 OppositeLines.pde
  16. +6 −0 README.md
  17. +16 −0 RGB.pde
  18. +32 −0 RadialStar.pde
  19. +25 −0 RadialStars.pde
  20. +42 −0 Routine.pde
  21. +29 −0 Star.pde
  22. +26 −0 Stars.pde
  23. +36 −0 Target.pde
  24. +19 −0 TargetScanner.pde
  25. +27 −0 WarpSpeedMrSulu.pde
  26. +37 −0 WarpStar.pde
  27. +27 −0 Waterfall.pde
  28. +27 −0 Waterfalls.pde
  29. +56 −0 Wave.pde
  30. +32 −0 Waves.pde
  31. +244 −0 WiiController.pde
  32. +49 −728 acw.pde
View
BIN .DS_Store
Binary file not shown.
View
@@ -0,0 +1 @@
+.DS_Store
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, WiiController controller) {
+ 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
@@ -0,0 +1,29 @@
+class CrawlTest extends Routine {
+ int y;
+ int x;
+
+ void setup() {
+ y=0;
+ x=0;
+ }
+
+ void draw() {
+ background(0);
+
+ if (frameCount % 4 == 0) {
+ x++;
+ }
+ if (x>width) {
+ x=0;
+ y++;
+
+ if (y>height) {
+ y=0;
+ }
+ }
+
+ stroke(255);
+ point(x,y);
+ }
+}
+
View
@@ -53,11 +53,12 @@ public class Dacwes {
this.port = 58082;
this.w = w;
this.h = h;
- buffer = new byte[257];
+ int bufferSize = 3*(w*h)+1;
+ buffer = new byte[bufferSize];
this.addressingMode = ADDRESSING_VERTICAL_NORMAL;
this.pixelsPerChannel = 8;
- for (int i=0; i<257; i++) {
+ for (int i=0; i<bufferSize; i++) {
buffer[i] = 0;
}
}
@@ -113,26 +114,49 @@ public class Dacwes {
}
return 0;
- }
+ }
+ public void sendMode(String modeName) {
+ byte modeBuffer[] = new byte[modeName.length()+1];
+
+ modeBuffer[0] = 2;
+ for(int i = 0; i < modeName.length(); i++) {
+ modeBuffer[i+1] = (byte)modeName.charAt(i);
+ }
+
+ udp.send(modeBuffer,address,port);
+ }
+
+ int maxSentByte = 0;
public void sendData() {
PImage image = get();
- if (image.width != w || image.height != h) {
- image.resize(w,h);
- }
+// if (image.width != w || image.height != h) {
+// image.resize(w,h);
+// }
image.loadPixels();
-
+ loadPixels();
+
int r;
+ int g;
+ int b;
buffer[0] = 1;
for (int y=0; y<h; y++) {
for (int x=0; x<w; x++) {
- r = int(brightness(image.pixels[y*w+x]));
- buffer[getAddress(x,y)+1] = byte(r);
+ //r = int(brightness(image.pixels[y*w+x]));
+ r = int(red(image.pixels[y*w+x]));
+ g = int(green(image.pixels[y*w+x]));
+ b = int(blue(image.pixels[y*w+x]));
+
+ 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
39 FFT.pde
@@ -0,0 +1,39 @@
+class FFTDemo extends Routine {
+ FFT fft;
+ Minim minim;
+ AudioInput audioin;
+
+ void setup(PApplet parent) {
+ super.setup(parent);
+ minim = new Minim(parent);
+ audioin = minim.getLineIn(Minim.STEREO, 2048);
+ fft = new FFT(audioin.bufferSize(), audioin.sampleRate());
+ }
+
+ void draw() {
+ long frame = frameCount - modeFrameStart;
+
+ background(0);
+ stroke(255);
+
+ fft.forward(audioin.mix);
+
+ for (int i = 0; i < fft.specSize(); i++)
+ {
+ // draw the line for frequency band i, scaling it by 4 so we can see it a bit better
+ // stroke(0,0,255);
+ // line(i, HEIGHT, i, HEIGHT - fft.getBand(i)*4);
+ // //line(i, HEIGHT, i, HEIGHT - fft.getBand(i));
+ float barHeight = fft.getBand(i)*4;
+ for (float c = 0; c < barHeight; c++) {
+ stroke(c/barHeight*255, 0, 255);
+ point(i, HEIGHT - c);
+ }
+ }
+
+ if (frame > FRAMERATE*TYPICAL_MODE_TIME) {
+ newMode();
+ }
+ }
+}
+
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,43 @@
+class FollowMouse extends Routine {
+ int color_angle = 0;
+ color[] colors = new color[] { color(255,0,0), color(0,255,0), color(0,0,255), color(255,255,0) };
+
+ void buttonAPressed() {
+ color tmp = colors[0];
+ colors[0] = colors[1];
+ colors[1] = colors[2];
+ colors[2] = colors[3];
+ colors[3] = tmp;
+ }
+
+ void draw() {
+ background(0);
+
+ int x = int((controller.roll+90)/180*width);
+ int y = int((controller.pitch+90)/180*height);
+
+ for (int row = 0; row < height; row++) {
+ for (int col = 0; col < width; col++) {
+ if(col > x && row > y) {
+ stroke(colors[0]);
+ }
+ else if(col > x && row < y) {
+ stroke(colors[1]);
+ }
+ else if(col < x && row > y) {
+ stroke(colors[2]);
+ }
+ else if(col < x && row < y) {
+ stroke(colors[3]);
+ }
+ 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,52 @@
+class Greetz extends Routine {
+ int FONT_SIZE = 16;
+ PFont font;
+ PImage imgCopy;
+ String messages[] = new String[] {
+ "N Y C R"//,
+ // "KOSTUME KULT",
+ // "BLACK LIGHT BALL"
+ // "COUNTRY CLUB"
+ };
+ String message = "N Y C R";
+
+ 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);
+ text(message, x, FONT_SIZE);
+
+ if (height/2 > FONT_SIZE) {
+
+ image(get(0,0,width,FONT_SIZE),0,20,width,height/2);
+ fill(0);
+ rect(0,0,width,FONT_SIZE);
+ //copy(0,0,width,FONT_SIZE,0,FONT_SIZE,width,FONT_SIZE/2);
+ //imgCopy = copy(0,0,width,FONT_SIZE);
+ //image(imgCopy,0,0,width,height);
+ }
+
+ 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();
+ }
+ }
+
+}
Oops, something went wrong.

0 comments on commit 41cc590

Please sign in to comment.