-
Notifications
You must be signed in to change notification settings - Fork 0
/
decay.h
61 lines (43 loc) · 898 Bytes
/
decay.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef __DECAY_H__
#define __DECAY_H__
#include "fadeout.h"
#include "pixel_dual.h"
class decay : public fadeout {
public:
decay(uint8_t decay_rate=4) : fadeout(FADE_BOTH, decay_rate) {
new fadeout(0);
}
protected:
virtual void frame(pixelArray **strip, WII **wii) {
fadeout::frame(strip, wii);
draw(strip[0]);
#ifdef TEENSYDUINO
draw(strip[1]);
#endif
}
virtual void draw(pixelArray *strip) {
strip->setPixelColor(
random(255),
pix_colorx[ random(0, 6) ]
);
}
private:
uint8_t rate;
};
class decayPew : public fadeout {
public:
decayPew() : fadeout(FADE_BOTH, 8) {}
protected:
virtual void frame(pixelArray **strip, WII **wii) {
fadeout::frame(strip, wii);
if (elapsed < 250) return;
elapsed -= 250;
dual->string(
"PEW",
random(0, GRID_WIDTH),
random(6, GRID_HEIGHT),
pix_colorx[ random(0, 6) ]
);
}
};
#endif //__DECAY_H__