-
-
Notifications
You must be signed in to change notification settings - Fork 69
Closed
Labels
bugSomething isn't workingSomething isn't workingpresentRelated to the main "present" featureRelated to the main "present" feature
Description
Description
When using multiple scenes, manim-slides appears to get confused with slide-order and replaying animations.
Take the following example:
from manim import *
from manim_slides import Slide
class Part1(Slide):
def construct(self):
self.add(MarkupText("Part 1").shift(3 * UP))
counter = DecimalNumber().shift(2 * UP)
self.add(counter)
square = Square(color=BLUE, fill_opacity=1)
self.play(square.animate.shift(LEFT))
self.next_slide()
counter.set_value(1)
self.play(square.animate.scale(0.3))
self.next_slide()
class Part2(Slide):
def construct(self):
self.add(MarkupText("Part 2").shift(3 * UP))
counter = DecimalNumber().shift(2 * UP)
self.add(counter)
square = Square(color=RED, fill_opacity=1)
self.play(square.animate.shift(3 * RIGHT))
counter.set_value(1)
self.play(square.animate.set_color(GRAY))
self.next_slide()
counter.set_value(2)
self.play(square.animate.scale(1.3))
self.next_slide()I am running these commands:
$ manim -qh bug.py Part1 Part2
$ manim-slides Part1 Part2
Steps to reproduce weird behavior
- Slideshow starts normally, blue square is shown moving left
- Press right arrow, Square shrinks. Immediately afterwards,
Part2starts (even though there is aself.next_slide()in the code that should pause) - After the red square moved right and turned gray, press the left arrow key.
Part1starts from the beginning, not from animation 2 - Press the right arrow once, the blue square shrinks and only the second animation from the first section of
Part2is shown (not the square moving right, but only the square turning gray)
Additional weird behavior
Remove the first self.next_slide() from Part1, leaving only the one at the end. Press the left arrow key while Part2 plays and observe the following Traceback:
Traceback (most recent call last):
File "/home/.../venv/lib/python3.11/site-packages/manim_slides/present.py", line 445, in run
self.handle_key()
File "/home/.../venv/lib/python3.11/site-packages/manim_slides/present.py", line 564, in handle_key
self.current_presentation.load_last_slide()
File "/home/.../venv/lib/python3.11/site-packages/manim_slides/present.py", line 275, in load_last_slide
self.current_slide_index >= 0
AssertionError: Slides should be at list of a least two elements
Sorry if this issue is a bit confusing, but separating it into multiple issues would probably not be helping.
Version
manim-slides, version 4.14.0, used with Manim Community v0.17.3
Platform
Linux
Screenshots
No response
Additional information
Possibly related to #161?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpresentRelated to the main "present" featureRelated to the main "present" feature