Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lib): add skip_animations compatibility #516

Merged
merged 8 commits into from
Jan 21, 2025
Merged
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(unreleased)=
## [Unreleased](https://github.com/jeertmans/manim-slides/compare/v5.3.1...HEAD)

(unreleased-added)=
### Added

- Added `skip_animations` compatibility with ManimCE.
[@Rapsssito](https://github.com/Rapsssito) [#516](https://github.com/jeertmans/manim-slides/pull/516)

(v5.3.1)=
## [v5.3.1](https://github.com/jeertmans/manim-slides/compare/v5.3.0...v5.3.1)

Expand Down
3 changes: 3 additions & 0 deletions manim_slides/slide/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ def next_slide(
Positional arguments passed to
:meth:`Scene.next_section<manim.scene.scene.Scene.next_section>`,
or ignored if `manimlib` API is used.
:param skip_animations:
Passed to `:meth:`Scene.next_section<manim.scene.scene.Scene.next_section>`,
or ignored if `manimlib` API is used.
Rapsssito marked this conversation as resolved.
Show resolved Hide resolved
:param loop:
If set, next slide will be looping.
:param auto_next:
Expand Down
2 changes: 1 addition & 1 deletion manim_slides/slide/manim.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def next_slide(
base_slide_config: BaseSlideConfig,
**kwargs: Any,
) -> None:
Scene.next_section(self, *args, **kwargs)
Scene.next_section(self, *args, skip_animations=base_slide_config.skip_animations, **kwargs)
BaseSlide.next_slide.__wrapped__(
self,
base_slide_config=base_slide_config,
Expand Down
14 changes: 14 additions & 0 deletions tests/test_slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,20 @@ def construct(self) -> None:
self.next_slide()
assert self._current_slide == 2

def test_next_slide_skip_animations(self) -> None:
@assert_constructs
class _(CESlide):
def construct(self) -> None:
# TODO: Check if the slide is missing from the JSON
circle = Circle(color=BLUE)
self.play(GrowFromCenter(circle))
self.next_slide(skip_animations=True)
square = Circle(color=BLUE)
self.play(GrowFromCenter(square))
self.next_slide()
self.play(GrowFromCenter(square))


def test_canvas(self) -> None:
@assert_constructs
class _(CESlide):
Expand Down
Loading