mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 19:46:21 +08:00
fix: pass args by calling animate
that borrowed from CE
This commit is contained in:
@ -2017,6 +2017,7 @@ class _AnimationBuilder:
|
||||
self.is_chaining = False
|
||||
self.methods: list[Callable] = []
|
||||
self.anim_args = {}
|
||||
self.can_pass_args = True
|
||||
|
||||
def __getattr__(self, method_name: str):
|
||||
method = getattr(self.mobject.target, method_name)
|
||||
@ -2041,6 +2042,9 @@ class _AnimationBuilder:
|
||||
self.is_chaining = True
|
||||
return update_target
|
||||
|
||||
def __call__(self, **kwargs):
|
||||
return self.set_anim_args(**kwargs)
|
||||
|
||||
def set_anim_args(self, **kwargs):
|
||||
'''
|
||||
You can change the args of :class:`~manimlib.animation.transform.Transform`, such as
|
||||
@ -2054,7 +2058,15 @@ class _AnimationBuilder:
|
||||
|
||||
and so on.
|
||||
'''
|
||||
|
||||
if not self.can_pass_args:
|
||||
raise ValueError(
|
||||
"Animation arguments can only be passed by calling ``animate`` "
|
||||
"or ``set_anim_args`` and can only be passed once",
|
||||
)
|
||||
|
||||
self.anim_args = kwargs
|
||||
self.can_pass_args = False
|
||||
return self
|
||||
|
||||
def build(self):
|
||||
|
Reference in New Issue
Block a user