summaryrefslogtreecommitdiffstats
path: root/Matrix_5x6
diff options
context:
space:
mode:
authorNils Schneider <nils.schneider@gmail.com>2011-11-06 19:31:22 +0100
committerNils Schneider <nils.schneider@gmail.com>2011-11-06 19:31:22 +0100
commitc85889e2d2c15e8166435b376bf36367a28ca844 (patch)
treef0a8614fbe7cb76d4e4e526a9ae9165fe17f8500 /Matrix_5x6
parentd79e7340e8b21fea4b0c28236314a5025879af50 (diff)
downloadledmatrix-c85889e2d2c15e8166435b376bf36367a28ca844.tar
ledmatrix-c85889e2d2c15e8166435b376bf36367a28ca844.zip
schnecke mit fading
Diffstat (limited to 'Matrix_5x6')
-rw-r--r--Matrix_5x6/Charlie/Charlie.pde73
1 files changed, 67 insertions, 6 deletions
diff --git a/Matrix_5x6/Charlie/Charlie.pde b/Matrix_5x6/Charlie/Charlie.pde
index ee7f5dd..d863a03 100644
--- a/Matrix_5x6/Charlie/Charlie.pde
+++ b/Matrix_5x6/Charlie/Charlie.pde
@@ -57,12 +57,14 @@ int aus = 10;
void setup(){ /*nothing*/ }
-void zufall_fading() {
+/* zufällige LEDs werden langsam dunkler */
+
+void zufall_fading_down() {
clrscr();
int x, y;
for (x=0; x<6; x++)
for (y=0; y<5; y++)
- scr[x][y] = random(30) + 2;
+ scr[x][y] = random(30);
int i=30;
@@ -73,12 +75,14 @@ void zufall_fading() {
}
-void zufall_fading2() {
+/* zufällige LEDs werden langsam heller */
+
+void zufall_fading_up() {
clrscr();
int x, y;
for (x=0; x<6; x++)
for (y=0; y<5; y++)
- scr[x][y] = - random(30) - 2;
+ scr[x][y] = - random(30);
int i=50;
@@ -86,10 +90,67 @@ void zufall_fading2() {
drawscr(2);
fadescr_up();
}
+}
-
+/* schnecke mit vier startpunkten (0 bis 3) von außen nach innnen
+ mit fading */
+
+void schnecke(int s) {
+ clrscr();
+ int x, y, d, w = 0;
+ d = s;
+ switch(s) {
+ case 0:
+ x = 0;
+ y = 0;
+ break;
+ case 1:
+ x = 5;
+ y = 0;
+ break;
+ case 2:
+ x = 5;
+ y = 4;
+ break;
+ case 3:
+ x = 0;
+ y = 4;
+ break;
+ }
+
+ while (1) {
+ if (scr[x][y]) break;
+
+ scr[x][y] = 20;
+ drawscr(2);
+ fadescr_down();
+
+ switch (d) {
+ case 0: if (x == 5 - w) {d = 1; if (s == 2) w++;} break;
+ case 1: if (y == 4 - w) {d = 2; if (s == 3) w++;} break;
+ case 2: if (x == w) {d = 3; if (s == 0) w++;} break;
+ case 3: if (y == w) {d = 0; if (s == 1) w++;} break;
+ }
+
+ switch (d) {
+ case 0: x++; break;
+ case 1: y++; break;
+ case 2: x--; break;
+ case 3: y--; break;
+ }
+ }
+ int i = 20;
+ while(i--) {
+ fadescr_down();
+ drawscr(2);
+ }
}
void loop() {
- zufall_fading2();
+// zufall_fading_up();
+// zufall_fading_down();
+ schnecke(0);
+ schnecke(1);
+ schnecke(2);
+ schnecke(3);
}