Skip to content

Commit

Permalink
Merge pull request #62 from makermelissa/master
Browse files Browse the repository at this point in the history
Slight performance improvement to animated gif player
  • Loading branch information
makermelissa authored Jan 10, 2020
2 parents 87b1f29 + 298cfc8 commit 7a5bf7a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/rgb_display_pillow_animated_gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,16 @@ def play(self):
return False
while True:
for frame_object in self._frames:
start_time = time.monotonic()
self.display.image(frame_object.image)
if not self.advance_button.value:
self.advance()
return False
if not self.back_button.value:
self.back()
return False
time.sleep(frame_object.duration / 1000)
while time.monotonic() < (start_time + frame_object.duration / 1000):
pass

if self._loop == 1:
return True
Expand Down

0 comments on commit 7a5bf7a

Please sign in to comment.