@@ -37,11 +37,13 @@ class Comet(Animation):
3737 :param pixel_object: The initialised LED object.
3838 :param float speed: Animation speed in seconds, e.g. ``0.1``.
3939 :param color: Animation color in ``(r, g, b)`` tuple, or ``0x000000`` hex format.
40+ :param background_color: Background color in ``(r, g, b)`` tuple, or ``0x000000`` hex format.
41+ Defaults to BLACK.
4042 :param int tail_length: The length of the comet. Defaults to 25% of the length of the
4143 ``pixel_object``. Automatically compensates for a minimum of 2 and a
4244 maximum of the length of the ``pixel_object``.
4345 :param bool reverse: Animates the comet in the reverse order. Defaults to ``False``.
44- :param bool bounce: Comet will bounce back and forth. Defaults to ``True ``.
46+ :param bool bounce: Comet will bounce back and forth. Defaults to ``False ``.
4547 :param Optional[string] name: A human-readable name for the Animation.
4648 Used by the to string function.
4749 :param bool ring: Ring mode. Defaults to ``False``.
@@ -53,6 +55,7 @@ def __init__(
5355 pixel_object ,
5456 speed ,
5557 color ,
58+ background_color = BLACK ,
5659 tail_length = 0 ,
5760 reverse = False ,
5861 bounce = False ,
@@ -70,6 +73,7 @@ def __init__(
7073 self ._color_step = 0.95 / tail_length
7174 self ._comet_colors = None
7275 self ._computed_color = color
76+ self ._background_color = background_color
7377 self ._num_pixels = len (pixel_object )
7478 self ._direction = - 1 if reverse else 1
7579 self ._left_side = - self ._tail_length
@@ -84,7 +88,7 @@ def __init__(
8488 on_cycle_complete_supported = True
8589
8690 def _set_color (self , color ):
87- self ._comet_colors = [BLACK ]
91+ self ._comet_colors = [self . _background_color ]
8892 for n in range (self ._tail_length ):
8993 self ._comet_colors .append (
9094 calculate_intensity (color , n * self ._color_step + 0.05 )
0 commit comments