cycle complete at start_color

This commit is contained in:
tneish 2023-12-27 22:33:33 +01:00
parent da467ce9b7
commit 43aa654b4d

View file

@ -40,7 +40,7 @@ class ColorCycle(Animation):
format. Defaults to a rainbow color cycle. format. Defaults to a rainbow color cycle.
:param start_color: An index (from 0) for which color to start from. Default 0 (first color). :param start_color: An index (from 0) for which color to start from. Default 0 (first color).
""" """
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
def __init__(self, pixel_object, speed, colors=RAINBOW, start_color=0, name=None): def __init__(self, pixel_object, speed, colors=RAINBOW, start_color=0, name=None):
self.colors = colors self.colors = colors
@ -61,7 +61,7 @@ class ColorCycle(Animation):
self._color = self.colors[index] self._color = self.colors[index]
yield yield
index = (index + 1) % len(self.colors) index = (index + 1) % len(self.colors)
if index == 0: if index == start_color:
self.cycle_complete = True self.cycle_complete = True
def reset(self): def reset(self):