Skip to content

Commit 9626ad4

Browse files
committed
add a way to control the color of each item in the chase
1 parent 7ac5968 commit 9626ad4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

adafruit_led_animation/animation.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,17 @@ def draw(self):
417417
self.pixel_object.fill((0, 0, 0))
418418
for n in range(self._n, self._n + self._size):
419419
num = self._num_repeats + (1 if n < self._overflow else 0)
420-
self.pixel_object[n::self._repeat_width] = [self.color] * num
420+
self.pixel_object[n::self._repeat_width] = [self.group_color(n) for n in range(num)]
421421
self.show()
422422

423+
def group_color(self, n):
424+
"""
425+
Generate the color for the n'th group
426+
427+
:param n: The pixel group to get the color for
428+
"""
429+
return self.color
430+
423431

424432
class AnimationSequence:
425433
"""

0 commit comments

Comments
 (0)