@@ -345,7 +345,22 @@ def update_meshes(self, dt):
345
345
for mesh in obj .get_family ():
346
346
mesh .update (dt )
347
347
348
- def update_self (self , dt ):
348
+ def update_self (self , dt : float ):
349
+ """Run all scene updater functions.
350
+
351
+ Among all types of update functions (mobject updaters, mesh updaters,
352
+ scene updaters), scene update functions are called last.
353
+
354
+ Parameters
355
+ ----------
356
+ dt
357
+ Scene time since last update.
358
+
359
+ See Also
360
+ --------
361
+ :meth:`.Scene.add_updater`
362
+ :meth:`.Scene.remove_updater`
363
+ """
349
364
for func in self .updaters :
350
365
func (dt )
351
366
@@ -503,10 +518,50 @@ def remove(self, *mobjects):
503
518
self .restructure_mobjects (mobjects , list_name , False )
504
519
return self
505
520
506
- def add_updater (self , func ):
521
+ def add_updater (self , func : Callable [[float ], None ]) -> None :
522
+ """Add an update function to the scene.
523
+
524
+ The scene updater functions are run every frame,
525
+ and they are the last type of updaters to run.
526
+
527
+ .. WARNING::
528
+
529
+ When using the Cairo renderer, scene updaters that
530
+ modify mobjects are not detected in the same way
531
+ that mobject updaters are. To be more concrete,
532
+ a mobject only modified via a scene updater will
533
+ not necessarily be added to the list of *moving
534
+ mobjects* and thus might not be updated every frame.
535
+
536
+ TL;DR: Use mobject updaters to update mobjects.
537
+
538
+ Parameters
539
+ ----------
540
+ func
541
+ The updater function. It takes a float, which is the
542
+ time difference since the last update (usually equal
543
+ to the frame rate).
544
+
545
+ See also
546
+ --------
547
+ :meth:`.Scene.remove_updater`
548
+ :meth:`.Scene.update_self`
549
+ """
507
550
self .updaters .append (func )
508
551
509
- def remove_updater (self , func ):
552
+ def remove_updater (self , func : Callable [[float ], None ]) -> None :
553
+ """Remove an update function from the scene.
554
+
555
+ Parameters
556
+ ----------
557
+ func
558
+ The updater function to be removed.
559
+
560
+ See also
561
+ --------
562
+ :meth:`.Scene.add_updater`
563
+ :meth:`.Scene.update_self`
564
+ """
510
565
self .updaters = [f for f in self .updaters if f is not func ]
511
566
512
567
def restructure_mobjects (
0 commit comments