commit
563f608f86
2 changed files with 18 additions and 8 deletions
|
|
@ -96,7 +96,7 @@ class Chase(Animation):
|
||||||
bar_no += 1
|
bar_no += 1
|
||||||
|
|
||||||
colorgen = bar_colors()
|
colorgen = bar_colors()
|
||||||
self.pixel_object[:] = [next(colorgen) for _ in self.pixel_object]
|
self.pixel_object[:] = [next(colorgen) for _ in range(len(self.pixel_object))]
|
||||||
|
|
||||||
if self.draw_count % len(self.pixel_object) == 0:
|
if self.draw_count % len(self.pixel_object) == 0:
|
||||||
self.cycle_complete = True
|
self.cycle_complete = True
|
||||||
|
|
|
||||||
|
|
@ -120,14 +120,24 @@ class Comet(Animation):
|
||||||
colors = self._comet_colors
|
colors = self._comet_colors
|
||||||
if self.reverse:
|
if self.reverse:
|
||||||
colors = reversed(colors)
|
colors = reversed(colors)
|
||||||
for pixel_no, color in enumerate(colors):
|
|
||||||
draw_at = self._tail_start + pixel_no
|
|
||||||
if draw_at < 0 or draw_at >= self._num_pixels:
|
|
||||||
if not self._ring:
|
|
||||||
continue
|
|
||||||
draw_at = draw_at % self._num_pixels
|
|
||||||
|
|
||||||
self.pixel_object[draw_at] = color
|
pixels = self.pixel_object
|
||||||
|
start = self._tail_start
|
||||||
|
npixels = len(pixels)
|
||||||
|
if self._ring:
|
||||||
|
start %= npixels
|
||||||
|
for color in colors:
|
||||||
|
pixels[start] = color
|
||||||
|
start += 1
|
||||||
|
if start == npixels:
|
||||||
|
start = 0
|
||||||
|
else:
|
||||||
|
for color in colors:
|
||||||
|
if start >= npixels:
|
||||||
|
break
|
||||||
|
if start >= 0:
|
||||||
|
pixels[start] = color
|
||||||
|
start += 1
|
||||||
|
|
||||||
self._tail_start += self._direction
|
self._tail_start += self._direction
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue