-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle.py
More file actions
39 lines (28 loc) · 993 Bytes
/
Copy pathsingle.py
File metadata and controls
39 lines (28 loc) · 993 Bytes
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
from base import LightBase
import colors
class Single(LightBase):
def __init__(self, index) -> None:
self.index = index
@property
def name(self):
return "Single"
@property
def tick_interval(self):
return 0
def tick(self, pixels, max):
pixels.fill((0, 0, 0))
pixels[self.index] = colors.RED1
def get_index(self, inital_offset, max):
index = self.indexes.get(inital_offset, inital_offset)
direction = self.directions.get(inital_offset, True)
if index + 1 == max:
self.directions[inital_offset] = False
direction = False
if not direction and index == 0:
self.directions[inital_offset] = True
direction = True
if direction:
self.indexes[inital_offset] = index + 1
if not direction:
self.indexes[inital_offset] = index - 1
return index