Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

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) ...

mirefek1f26ce44f418
diff --git a/mobject/vectorized_mobject.py b/mobject/vectorized_mobject.py
index 7456223cf..439851f2a 100644
--- a/mobject/vectorized_mobject.py
+++ b/mobject/vectorized_mobject.py
@@ -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 = {