@@ -274,6 +274,11 @@ def background_color(self, colors: str | tuple[float]):
274274 """1, 2, or 4 colors, each color must be acceptable by pygfx.Color"""
275275 self ._background_material .set_colors (* colors )
276276
277+ @property
278+ def animations (self ) -> dict [str , list [callable ]]:
279+ """Returns a dictionary of 'pre' and 'post' animation functions."""
280+ return {"pre" : self ._animate_funcs_pre , "post" : self ._animate_funcs_post }
281+
277282 def map_screen_to_world (
278283 self , pos : tuple [float , float ] | pygfx .PointerEvent , allow_outside : bool = False
279284 ) -> np .ndarray | None :
@@ -395,6 +400,37 @@ def remove_animation(self, func):
395400 if func in self ._animate_funcs_post :
396401 self ._animate_funcs_post .remove (func )
397402
403+ def clear_animations (self , removal : str = None ):
404+ """
405+ Remove animation functions.
406+
407+ Parameters
408+ ----------
409+ removal: str, default ``None``
410+ The type of animation functions to clear. One of 'pre' or 'post'. If `None`, removes all animation
411+ functions.
412+ """
413+ if removal is None :
414+ # remove all
415+ for func in self ._animate_funcs_pre :
416+ self ._animate_funcs_pre .remove (func )
417+
418+ for func in self ._animate_funcs_post :
419+ self ._animate_funcs_post .remove (func )
420+ elif removal == "pre" :
421+ # only pre
422+ for func in self ._animate_funcs_pre :
423+ self ._animate_funcs_pre .remove (func )
424+ elif removal == "post" :
425+ # only post
426+ for func in self ._animate_funcs_post :
427+ self ._animate_funcs_post .remove (func )
428+ else :
429+ raise ValueError (
430+ f"Animation type: { removal } must be one of 'pre' or 'post'. To remove all animation "
431+ f"functions, pass `type=None`"
432+ )
433+
398434 def _sort_images_by_depth (self ):
399435 """
400436 In general, we want to avoid setting the offset of a graphic, because the
0 commit comments