mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 17:29:06 +08: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:
@ -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 = {
|
||||
|
Reference in New Issue
Block a user