mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
When calling Scene.play on a method followed by its args, if you end the list with a dict, it will interpret it as the kwargs of the method.
This commit is contained in:
parent
fcd1e7d6a5
commit
d07efc6cb5
1 changed files with 12 additions and 4 deletions
|
@ -340,8 +340,9 @@ class Scene(object):
|
|||
|
||||
def compile_play_args_to_animation_list(self, *args):
|
||||
"""
|
||||
Eacn arg can either be an animation, or a mobject method
|
||||
followed by that methods arguments.
|
||||
Each arg can either be an animation, or a mobject method
|
||||
followed by that methods arguments (and potentially follow
|
||||
by a dict of kwargs for that method).
|
||||
|
||||
This animation list is built by going through the args list,
|
||||
and each animation is simply added, but when a mobject method
|
||||
|
@ -364,8 +365,15 @@ class Scene(object):
|
|||
#method should already have target then.
|
||||
else:
|
||||
mobject.target = mobject.copy()
|
||||
#
|
||||
if isinstance(state["method_args"][-1], dict):
|
||||
method_kwargs = state["method_args"].pop()
|
||||
else:
|
||||
method_kwargs = {}
|
||||
state["curr_method"].im_func(
|
||||
mobject.target, *state["method_args"]
|
||||
mobject.target,
|
||||
*state["method_args"],
|
||||
**method_kwargs
|
||||
)
|
||||
animations.append(MoveToTarget(mobject))
|
||||
state["last_method"] = state["curr_method"]
|
||||
|
|
Loading…
Add table
Reference in a new issue