fix sparklepulse to use _set_color
This commit is contained in:
parent
7b5ba8222e
commit
beaa41f0cb
2 changed files with 5 additions and 2 deletions
|
|
@ -185,6 +185,8 @@ class Animation:
|
||||||
def color(self, color):
|
def color(self, color):
|
||||||
if self._color == color:
|
if self._color == color:
|
||||||
return
|
return
|
||||||
|
if isinstance(color, int):
|
||||||
|
color = (color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF)
|
||||||
self._set_color(color)
|
self._set_color(color)
|
||||||
|
|
||||||
def _set_color(self, color):
|
def _set_color(self, color):
|
||||||
|
|
@ -192,8 +194,6 @@ class Animation:
|
||||||
Called after the color is changed, which includes at initialization.
|
Called after the color is changed, which includes at initialization.
|
||||||
Override as needed.
|
Override as needed.
|
||||||
"""
|
"""
|
||||||
if isinstance(color, int):
|
|
||||||
color = (color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF)
|
|
||||||
self._color = color
|
self._color = color
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,9 @@ class SparklePulse(Sparkle):
|
||||||
)
|
)
|
||||||
self._generator = pulse_generator(self._period, self, dotstar_pwm=dotstar)
|
self._generator = pulse_generator(self._period, self, dotstar_pwm=dotstar)
|
||||||
|
|
||||||
|
def _set_color(self, color):
|
||||||
|
self._color = color
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
self._sparkle_color = next(self._generator)
|
self._sparkle_color = next(self._generator)
|
||||||
super().draw()
|
super().draw()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue