mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
fix: pass args by calling animate
that borrowed from CE
This commit is contained in:
parent
2f691355db
commit
603a773847
1 changed files with 12 additions and 0 deletions
|
@ -2017,6 +2017,7 @@ class _AnimationBuilder:
|
||||||
self.is_chaining = False
|
self.is_chaining = False
|
||||||
self.methods: list[Callable] = []
|
self.methods: list[Callable] = []
|
||||||
self.anim_args = {}
|
self.anim_args = {}
|
||||||
|
self.can_pass_args = True
|
||||||
|
|
||||||
def __getattr__(self, method_name: str):
|
def __getattr__(self, method_name: str):
|
||||||
method = getattr(self.mobject.target, method_name)
|
method = getattr(self.mobject.target, method_name)
|
||||||
|
@ -2041,6 +2042,9 @@ class _AnimationBuilder:
|
||||||
self.is_chaining = True
|
self.is_chaining = True
|
||||||
return update_target
|
return update_target
|
||||||
|
|
||||||
|
def __call__(self, **kwargs):
|
||||||
|
return self.set_anim_args(**kwargs)
|
||||||
|
|
||||||
def set_anim_args(self, **kwargs):
|
def set_anim_args(self, **kwargs):
|
||||||
'''
|
'''
|
||||||
You can change the args of :class:`~manimlib.animation.transform.Transform`, such as
|
You can change the args of :class:`~manimlib.animation.transform.Transform`, such as
|
||||||
|
@ -2054,7 +2058,15 @@ class _AnimationBuilder:
|
||||||
|
|
||||||
and so on.
|
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.anim_args = kwargs
|
||||||
|
self.can_pass_args = False
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue