From 8c578d257774f440a858c2428d515fb505354076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Mon, 20 Mar 2023 16:24:36 +0100 Subject: [PATCH] fix(cli): do not terminate slides early (#162) * fix(cli): do not terminate slides early When a slide is replayed (either normally or reversed), its state must be reset. Closes #161 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- example.py | 19 +++++++++++++++++++ manim_slides/present.py | 2 ++ 2 files changed, 21 insertions(+) diff --git a/example.py b/example.py index 4fb7afd..fc7a8f2 100644 --- a/example.py +++ b/example.py @@ -32,6 +32,25 @@ class BasicExample(Slide): self.next_slide() # Waits user to press continue to go to the next slide +class MultipleAnimationsInLastSlide(Slide): + """This is used to check against solution for issue #161.""" + + def construct(self): + circle = Circle(color=BLUE) + dot = Dot() + + self.play(GrowFromCenter(circle)) + self.play(FadeIn(dot)) + self.next_slide() + + self.play(dot.animate.move_to(RIGHT)) + self.play(dot.animate.move_to(UP)) + self.play(dot.animate.move_to(LEFT)) + self.play(dot.animate.move_to(DOWN)) + + self.next_slide() + + class TestFileTooLong(Slide): """This is used to check against solution for issue #123.""" diff --git a/manim_slides/present.py b/manim_slides/present.py index 8f55fcb..e635c1c 100644 --- a/manim_slides/present.py +++ b/manim_slides/present.py @@ -199,6 +199,8 @@ class Presentation: def rewind_current_slide(self) -> None: """Rewinds current slide to first frame.""" logger.debug("Rewinding current slide") + self.current_slide.terminated = False + if self.reverse: self.current_animation = self.current_slide.end_animation - 1 else: