@@ -252,7 +252,9 @@ def play(self, *args: Any, **kwargs: Any) -> None:
252
252
super ().play (* args , ** kwargs ) # type: ignore[misc]
253
253
self ._current_animation += 1
254
254
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 :
256
258
"""
257
259
Create a new slide with previous animations, and setup options
258
260
for the next slide.
@@ -266,6 +268,12 @@ def next_slide(self, *, loop: bool = False, **kwargs: Any) -> None:
266
268
or ignored if `manimlib` API is used.
267
269
:param loop:
268
270
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``.
269
277
:param kwargs:
270
278
Keyword arguments to be passed to
271
279
:meth:`Scene.next_section<manim.scene.scene.Scene.next_section>`,
@@ -328,6 +336,28 @@ def construct(self):
328
336
self.next_slide()
329
337
330
338
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)
331
361
"""
332
362
if self ._current_animation > self ._start_animation :
333
363
if self .wait_time_between_slides > 0.0 :
@@ -343,7 +373,7 @@ def construct(self):
343
373
344
374
self ._current_slide += 1
345
375
346
- self ._pre_slide_config_kwargs = dict (loop = loop )
376
+ self ._pre_slide_config_kwargs = dict (loop = loop , auto_next = auto_next )
347
377
self ._start_animation = self ._current_animation
348
378
349
379
def _add_last_slide (self ) -> None :
0 commit comments