@@ -252,7 +252,9 @@ def play(self, *args: Any, **kwargs: Any) -> None:
252252 super ().play (* args , ** kwargs ) # type: ignore[misc]
253253 self ._current_animation += 1
254254
255- def next_slide (self , * , loop : bool = False , ** kwargs : Any ) -> None :
255+ def next_slide (
256+ self , * , loop : bool = False , auto_next : bool = False , ** kwargs : Any
257+ ) -> None :
256258 """
257259 Create a new slide with previous animations, and setup options
258260 for the next slide.
@@ -266,6 +268,12 @@ def next_slide(self, *, loop: bool = False, **kwargs: Any) -> None:
266268 or ignored if `manimlib` API is used.
267269 :param loop:
268270 If set, next slide will be looping.
271+ :param auto_next:
272+ If set, next slide will play immediately play the next slide
273+ upon terminating.
274+
275+ Note that this is only supported by ``manim-slides present``
276+ and ``manim-slides convert --to=html``.
269277 :param kwargs:
270278 Keyword arguments to be passed to
271279 :meth:`Scene.next_section<manim.scene.scene.Scene.next_section>`,
@@ -328,6 +336,28 @@ def construct(self):
328336 self.next_slide()
329337
330338 self.play(FadeOut(dot))
339+
340+ The following contains one slide that triggers the next slide
341+ upon terminating.
342+
343+ .. manim-slides:: AutoNextExample
344+
345+ from manim import *
346+ from manim_slides import Slide
347+
348+ class AutoNextExample(Slide):
349+ def construct(self):
350+ square = Square(color=RED, side_length=2)
351+
352+ self.play(GrowFromCenter(square))
353+
354+ self.next_slide(auto_next=True)
355+
356+ self.play(Wiggle(square))
357+
358+ self.next_slide()
359+
360+ self.wipe(square)
331361 """
332362 if self ._current_animation > self ._start_animation :
333363 if self .wait_time_between_slides > 0.0 :
@@ -343,7 +373,7 @@ def construct(self):
343373
344374 self ._current_slide += 1
345375
346- self ._pre_slide_config_kwargs = dict (loop = loop )
376+ self ._pre_slide_config_kwargs = dict (loop = loop , auto_next = auto_next )
347377 self ._start_animation = self ._current_animation
348378
349379 def _add_last_slide (self ) -> None :
0 commit comments