From 712023d845f54c9475707cdf8a875fa3a47553ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Mon, 20 Mar 2023 15:50:53 +0100 Subject: [PATCH 1/2] fix(cli): do not terminate slides early When a slide is replayed (either normally or reversed), its state must be reset. Closes #161 --- example.py | 19 +++++++++++++++++++ manim_slides/present.py | 2 ++ 2 files changed, 21 insertions(+) diff --git a/example.py b/example.py index 4fb7afdb..ade8c7d7 100644 --- a/example.py +++ b/example.py @@ -32,6 +32,25 @@ def construct(self): 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 8f55fcb5..e635c1c5 100644 --- a/manim_slides/present.py +++ b/manim_slides/present.py @@ -199,6 +199,8 @@ def current_cap(self) -> cv2.VideoCapture: 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: From d1c640c1007fd5613b38bbd1bd35e2fdedf46108 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Mar 2023 14:51:23 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.py b/example.py index ade8c7d7..fc7a8f29 100644 --- a/example.py +++ b/example.py @@ -47,7 +47,7 @@ def construct(self): self.play(dot.animate.move_to(UP)) self.play(dot.animate.move_to(LEFT)) self.play(dot.animate.move_to(DOWN)) - + self.next_slide()