-
Notifications
You must be signed in to change notification settings - Fork 0
/
wavelights.py
42 lines (36 loc) · 856 Bytes
/
wavelights.py
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
from base import LightBase
import random
import colors
COLOR_CHOICES = [
colors.RED1,
colors.RED1,
colors.RED1,
colors.WHITE,
colors.WHITE,
colors.WHITE,
colors.BLUE,
colors.BLUE,
colors.BLUE,
# colors.PINK,
# colors.AZURE4,
# colors.MAGENTA,
# colors.LIMEGREEN,
# colors.MIDNIGHTBLUE
]
# COLOR_CHOICES.extend(colors.BLACK * 5)
class WaveLights(LightBase):
def __init__(self) -> None:
self.len = len(COLOR_CHOICES) - 1
self.start = 0
@property
def name(self):
return "Wave"
@property
def tick_interval(self):
return 0.1
def tick(self, pixels, max):
c = self.start
for x in range(0, max):
pixels[x] = COLOR_CHOICES[c]
c = (c + 1) % self.len
self.start = (self.start + 1) % self.len