@@ -37,11 +37,13 @@ class Comet(Animation):
37
37
:param pixel_object: The initialised LED object.
38
38
:param float speed: Animation speed in seconds, e.g. ``0.1``.
39
39
: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.
40
42
:param int tail_length: The length of the comet. Defaults to 25% of the length of the
41
43
``pixel_object``. Automatically compensates for a minimum of 2 and a
42
44
maximum of the length of the ``pixel_object``.
43
45
: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 ``.
45
47
:param Optional[string] name: A human-readable name for the Animation.
46
48
Used by the to string function.
47
49
:param bool ring: Ring mode. Defaults to ``False``.
@@ -53,6 +55,7 @@ def __init__(
53
55
pixel_object ,
54
56
speed ,
55
57
color ,
58
+ background_color = BLACK ,
56
59
tail_length = 0 ,
57
60
reverse = False ,
58
61
bounce = False ,
@@ -70,6 +73,7 @@ def __init__(
70
73
self ._color_step = 0.95 / tail_length
71
74
self ._comet_colors = None
72
75
self ._computed_color = color
76
+ self ._background_color = background_color
73
77
self ._num_pixels = len (pixel_object )
74
78
self ._direction = - 1 if reverse else 1
75
79
self ._left_side = - self ._tail_length
@@ -84,7 +88,7 @@ def __init__(
84
88
on_cycle_complete_supported = True
85
89
86
90
def _set_color (self , color ):
87
- self ._comet_colors = [BLACK ]
91
+ self ._comet_colors = [self . _background_color ]
88
92
for n in range (self ._tail_length ):
89
93
self ._comet_colors .append (
90
94
calculate_intensity (color , n * self ._color_step + 0.05 )
0 commit comments