mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Editing ApplyMethod so that if the last arg is a dict, it's treated as kwargs for the method
This commit is contained in:
parent
850b6f9e88
commit
48dad34f95
1 changed files with 7 additions and 1 deletions
|
@ -143,7 +143,13 @@ class ApplyMethod(Transform):
|
|||
"the method you want to animate"
|
||||
)
|
||||
assert(isinstance(method.im_self, Mobject))
|
||||
method_kwargs = kwargs.get("method_kwargs", {})
|
||||
args = list(args) #So that args.pop() works
|
||||
if "method_kwargs" in kwargs:
|
||||
method_kwargs = kwargs["method_kwargs"]
|
||||
elif isinstance(args[-1], dict):
|
||||
method_kwargs = args.pop()
|
||||
else:
|
||||
method_kwargs = {}
|
||||
target = method.im_self.copy()
|
||||
method.im_func(target, *args, **method_kwargs)
|
||||
Transform.__init__(self, method.im_self, target, **kwargs)
|
||||
|
|
Loading…
Add table
Reference in a new issue