-
Notifications
You must be signed in to change notification settings - Fork 14
/
FxXor.ino
57 lines (45 loc) · 1.11 KB
/
FxXor.ino
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
int xorR, xorG, xorB;
uint8_t xormode;
void setupXor(uint8_t _xormode) {
xormode = _xormode;
}
void loopXor() {
uint16_t ofs;
for (uint16_t i=0; i < strip.numPixels(); i++) {
ofs = i+frames;
switch (xormode) {
case 0:
xorR = (ofs^4)%256;
xorG = ((ofs>>1)^i)%256;
xorB = (ofs^frames)%256;
break;
case 1:
xorR = (ofs^4)%256;
xorG = ((ofs>>1)^frames)%256;
xorB = (xorR^xorG)%256;
break;
case 2:
xorR = (ofs^i)%256;
xorG = (ofs^i)%256;
xorB = (ofs^xorR)%256;
break;
case 3:
xorR = (i*(frames>>1))%256;
xorG = (i^ofs)%256;
xorB = (ofs)%256;
break;
case 4:
xorR = (frames*i)%256;
xorG = xorR;
xorB = xorR;
break;
case 5:
ofs >>= 3;
xorR = (ofs*ofs)%256;
xorG = (i*ofs>>1)%256;
xorB = ((frames>>3)*ofs>>1)%256;
break;
}
setTintPixelColor(i, Color(xorR, xorG, xorB) );
}
}