mirror of
https://github.com/3b1b/manim.git
synced 2025-07-29 13:03:31 +08:00
Merge branch 'master' of github.com:3b1b/manim into video-work
This commit is contained in:
@ -82,6 +82,14 @@ class Mobject(object):
|
||||
def __str__(self):
|
||||
return self.__class__.__name__
|
||||
|
||||
def __add__(self, other : 'Mobject') -> 'Mobject':
|
||||
assert(isinstance(other, Mobject))
|
||||
return self.get_group_class()(self, other)
|
||||
|
||||
def __mul__(self, other : 'int') -> 'Mobject':
|
||||
assert(isinstance(other, int))
|
||||
return self.replicate(other)
|
||||
|
||||
def init_data(self):
|
||||
self.data = {
|
||||
"points": np.zeros((0, 3)),
|
||||
@ -1609,6 +1617,10 @@ class Group(Mobject):
|
||||
raise Exception("All submobjects must be of type Mobject")
|
||||
Mobject.__init__(self, **kwargs)
|
||||
self.add(*mobjects)
|
||||
|
||||
def __add__(self, other : 'Mobject' or 'Group'):
|
||||
assert(isinstance(other, Mobject))
|
||||
return self.add(other)
|
||||
|
||||
|
||||
class Point(Mobject):
|
||||
|
@ -999,6 +999,10 @@ class VGroup(VMobject):
|
||||
raise Exception("All submobjects must be of type VMobject")
|
||||
super().__init__(**kwargs)
|
||||
self.add(*vmobjects)
|
||||
|
||||
def __add__(self:'VGroup', other : 'VMobject' or 'VGroup'):
|
||||
assert(isinstance(other, VMobject))
|
||||
return self.add(other)
|
||||
|
||||
|
||||
class VectorizedPoint(Point, VMobject):
|
||||
|
Reference in New Issue
Block a user