Code: Select all
on_cycle_complete_supported = True
def on_cycle_complete(self):
"""
Called by some animations when they complete an animation cycle.
Animations that support cycle complete notifications will have X property set to False.
Override as needed.
"""
self.cycle_count += 1
if self.cycle_count % self.notify_cycles == 0:
for callback in self._also_notify:
callback(self)
Code: Select all
def draw(self):
self._pixels = [self._random_in_mask() for _ in range(self._num_sparkles)]
for pixel in self._pixels:
self.pixel_object[pixel] = self._sparkle_color
if self.draw_count % len(self.pixel_object) == 0:
print("what the hell")
self.cycle_complete()
Code: Select all
if self.draw_count % len(self.pixel_object) == 0:
self.cycle_complete = True
self._offset = (self._offset + self._direction) % self._repeat_width