Update vectorized_mobject.py

This commit is contained in:
BillyLikesHacking
2021-10-22 20:03:58 +08:00
committed by GitHub
parent 030fb52018
commit c94ebaa260

View File

@ -993,6 +993,16 @@ class VGroup(VMobject):
raise Exception("All submobjects must be of type VMobject") raise Exception("All submobjects must be of type VMobject")
super().__init__(**kwargs) super().__init__(**kwargs)
self.add(*vmobjects) self.add(*vmobjects)
def __add__(self:'VGroup', other : 'VMobject' or 'VGroup'):
assert(isinstance(other, VMobject))
if isinstance(other, VGroup):
return VGroup(*self, *other)
if isinstance(other, Mobject):
return Group(*self) + other
if other in self:
return self.add(other.copy())
return self.add(other)
class VectorizedPoint(Point, VMobject): class VectorizedPoint(Point, VMobject):