Rundbunt Mini Pattern: Unterschied zwischen den Versionen
Aus Hackerspace Ffm
(Die Seite wurde neu angelegt: „=Matrix Rain Code= Globale Variablen: <pre>int pos[8] = {0,0,0,0,0,0,0,0}; int lng[8] = {1,1,1,1,1,1,1,1}; </pre> Pattern code: <pre> case 4: { CHSV c…“) |
(→Matrix Rain Code) |
||
| Zeile 14: | Zeile 14: | ||
for(uint8_t x=0; x<8; x++) { | for(uint8_t x=0; x<8; x++) { | ||
int h=pos[x]; | int h=pos[x]; | ||
| + | int r=lng[x]; | ||
| + | if(h<0) r = r+h; | ||
| + | |||
for(uint8_t y=0; y<8; y++) { | for(uint8_t y=0; y<8; y++) { | ||
if(h == y) { | if(h == y) { | ||
hsvbuf1[x*8+y] = c_p; | hsvbuf1[x*8+y] = c_p; | ||
} else | } else | ||
| − | if(h < y) { | + | if(h < y) { |
| − | hsvbuf1[x*8+y] = c_t; | + | if(r<y) { |
| + | hsvbuf1[x*8+y] = c_bg; | ||
| + | } else { | ||
| + | hsvbuf1[x*8+y] = c_t; | ||
| + | } | ||
} else { | } else { | ||
hsvbuf1[x*8+y] = c_bg; | hsvbuf1[x*8+y] = c_bg; | ||
Aktuelle Version vom 4. Oktober 2015, 17:01 Uhr
Matrix Rain Code
Globale Variablen:
int pos[8] = {0,0,0,0,0,0,0,0};
int lng[8] = {1,1,1,1,1,1,1,1};
Pattern code:
case 4:
{
CHSV c_bg(113,100,0);
CHSV c_t(113,100,200);
CHSV c_p(113,100,230);
for(uint8_t x=0; x<8; x++) {
int h=pos[x];
int r=lng[x];
if(h<0) r = r+h;
for(uint8_t y=0; y<8; y++) {
if(h == y) {
hsvbuf1[x*8+y] = c_p;
} else
if(h < y) {
if(r<y) {
hsvbuf1[x*8+y] = c_bg;
} else {
hsvbuf1[x*8+y] = c_t;
}
} else {
hsvbuf1[x*8+y] = c_bg;
}
}
if(lng[x] > -pos[x]) {
pos[x]--;
} else {
pos[x] = random(8, 30);
lng[x] = random(6,12);
}
}
showHSVg(hsvbuf1);
lng[0] = random(6,12);
int d = map(para[1], 0,1023, 100,500);
delay(d);
}