mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Feature: fine-tuned VGroup: allowing (nested) tuples or lists in constructor
VGroup([a,b,c]) = VGroup(a,b,c) VGroup([a,b], c) = VGroup(VGroup(a,b), c) ...
This commit is contained in:
parent
b709127339
commit
1f26ce44f4
1 changed files with 12 additions and 2 deletions
|
@ -426,8 +426,18 @@ class VMobject(Mobject):
|
|||
return self
|
||||
|
||||
class VGroup(VMobject):
|
||||
#Alternate name to improve readability during use
|
||||
pass
|
||||
def __init__(self, *args, **kwargs):
|
||||
if len(args) == 1 and isinstance(args[0], (tuple, list)):
|
||||
args = args[0]
|
||||
|
||||
packed_args = []
|
||||
for arg in args:
|
||||
if isinstance(arg, (tuple, list)):
|
||||
packed_args.append(VGroup(arg))
|
||||
else: packed_args.append(arg)
|
||||
|
||||
VMobject.__init__(self, *packed_args, **kwargs)
|
||||
|
||||
|
||||
class VectorizedPoint(VMobject):
|
||||
CONFIG = {
|
||||
|
|
Loading…
Add table
Reference in a new issue