Move misplaced computation of wheel_index into the case for precompute_rainbow=True

This commit is contained in:
indomitableSwan 2024-08-21 15:14:52 -04:00
parent 576a094602
commit 3d91a78621

View file

@ -85,9 +85,9 @@ class Rainbow(Animation):
if pos < last_pos: if pos < last_pos:
cycle_completed = True cycle_completed = True
last_pos = pos last_pos = pos
wheel_index = int((pos / period) * len(self.colors))
if self.colors: if self.colors:
wheel_index = int((pos / period) * len(self.colors))
self._draw_precomputed(num_pixels, wheel_index) self._draw_precomputed(num_pixels, wheel_index)
else: else:
wheel_index = int((pos / period) * 256) wheel_index = int((pos / period) * 256)