We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4240a4b commit 3aa735aCopy full SHA for 3aa735a
adafruit_led_animation/animation/comet.py
@@ -73,16 +73,16 @@ def __init__(
73
pixel_object,
74
speed,
75
color,
76
- tail_length=10,
+ tail_length=None,
77
reverse=False,
78
bounce=False,
79
name=None,
80
):
81
- if tail_length > len(pixel_object):
82
- raise ValueError(
83
- "Tail length must be less than the length of the pixel_object."
84
- )
85
- self._tail_length = tail_length + 1
+ if tail_length is None:
+ tail_length = int(len(pixel_object) / 4)
+ else:
+ tail_length = max(2, min(tail_length, len(pixel_object)))
+ self._tail_length = tail_length
86
self._color_step = 0.9 / tail_length
87
self._color_offset = 0.1
88
self._comet_colors = None
0 commit comments