File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
adafruit_led_animation/animation Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -104,17 +104,21 @@ def _comet_recompute_color(self, color):
104
104
self ._computed_color = color
105
105
106
106
def draw (self ):
107
- for pixel_no in range (self ._tail_length + 1 ):
107
+ colors = self ._comet_colors
108
+ if self .reverse :
109
+ colors = reversed (colors )
110
+ for pixel_no , color in enumerate (colors ):
108
111
draw_at = self ._tail_start + pixel_no
109
112
if draw_at < 0 or draw_at >= self ._num_pixels :
110
113
continue
111
- self .pixel_object [draw_at ] = self . _comet_colors [ pixel_no * self . _direction ]
114
+ self .pixel_object [draw_at ] = color
112
115
113
116
self ._tail_start += self ._direction
114
117
115
118
if self ._tail_start < self ._left_side or self ._tail_start >= self ._right_side :
116
- self .reverse = not self .reverse
117
- self ._direction = - self ._direction
119
+ if self .bounce :
120
+ self .reverse = not self .reverse
121
+ self ._direction = - self ._direction
118
122
if self .reverse == self ._initial_reverse :
119
123
self .cycle_complete = True
120
124
You can’t perform that action at this time.
0 commit comments