@@ -386,7 +386,7 @@ def add_to_back(self, *mobjects: "Mobject") -> "Mobject":
386
386
return self
387
387
388
388
def remove (self , * mobjects : "Mobject" ) -> "Mobject" :
389
- """Remove submobjects.
389
+ """Remove :attr:` submobjects` .
390
390
391
391
The mobjects are removed from :attr:`submobjects`, if they exist.
392
392
@@ -635,12 +635,13 @@ def show(self, camera=None):
635
635
self .get_image (camera = camera ).show ()
636
636
637
637
def save_image (self , name = None ):
638
+ """Saves an image of only this :class:`Mobject` at its position to a png file."""
638
639
self .get_image ().save (
639
640
Path (config .get_dir ("video_dir" )).joinpath ((name or str (self )) + ".png" )
640
641
)
641
642
642
643
def copy (self ) -> "Mobject" :
643
- """Create and return an identical copy of the Mobject including all submobjects.
644
+ """Create and return an identical copy of the :class:` Mobject` including all :attr:` submobjects` .
644
645
645
646
Returns
646
647
-------
@@ -1649,6 +1650,7 @@ def fade(self, darkness=0.5, family=True):
1649
1650
return self
1650
1651
1651
1652
def get_color (self ):
1653
+ """Returns the color of the :class:`~.Mobject`"""
1652
1654
return self .color
1653
1655
1654
1656
##
@@ -1879,12 +1881,15 @@ def match_coord(self, mobject: "Mobject", dim, direction=ORIGIN):
1879
1881
)
1880
1882
1881
1883
def match_x (self , mobject : "Mobject" , direction = ORIGIN ):
1884
+ """Match x coord. to the x coord. of another :class:`~.Mobject`."""
1882
1885
return self .match_coord (mobject , 0 , direction )
1883
1886
1884
- def match_y (self , mobject : "Mobject" , direction = ORIGIN ):
1887
+ def Match_y (self , mobject : "Mobject" , direction = ORIGIN ):
1888
+ """Match y coord. to the x coord. of another :class:`~.Mobject`."""
1885
1889
return self .match_coord (mobject , 1 , direction )
1886
1890
1887
1891
def match_z (self , mobject : "Mobject" , direction = ORIGIN ):
1892
+ """Match z coord. to the x coord. of another :class:`~.Mobject`."""
1888
1893
return self .match_coord (mobject , 2 , direction )
1889
1894
1890
1895
def align_to (
@@ -1954,7 +1959,7 @@ def arrange(
1954
1959
center = True ,
1955
1960
** kwargs ,
1956
1961
):
1957
- """Sorts mobjects next to each other on screen.
1962
+ """Sorts :class:`~.Mobject` next to each other on screen.
1958
1963
1959
1964
Examples
1960
1965
--------
@@ -2011,19 +2016,68 @@ def shuffle(self, recursive=False):
2011
2016
random .shuffle (self .submobjects )
2012
2017
2013
2018
def invert (self , recursive = False ):
2019
+ """Inverts the list of :attr:`submobjects`.
2020
+
2021
+ Examples
2022
+ --------
2023
+
2024
+ .. manim:: InvertSumobjectsExample
2025
+
2026
+ class InvertSumobjectsExample(Scene):
2027
+ def construct(self):
2028
+ s= VGroup(*[Dot().shift(i*0.1*RIGHT) for i in range(-20,20)])
2029
+ s2= s.copy()
2030
+ s2.invert()
2031
+ s2.shift(DOWN)
2032
+ self.play(Write(s), Write(s2))
2033
+ """
2014
2034
if recursive :
2015
2035
for submob in self .submobjects :
2016
2036
submob .invert (recursive = True )
2017
2037
list .reverse (self .submobjects )
2018
2038
2019
2039
# Just here to keep from breaking old scenes.
2020
2040
def arrange_submobjects (self , * args , ** kwargs ):
2041
+ """Arrange the position of :attr:`submobjects` with a small buffer.
2042
+
2043
+ Examples
2044
+ --------
2045
+
2046
+ .. manim:: ArrangeSumobjectsExample
2047
+ :save_last_frame:
2048
+
2049
+ class ArrangeSumobjectsExample(Scene):
2050
+ def construct(self):
2051
+ s= VGroup(*[Dot().shift(i*0.1*RIGHT*np.random.uniform(-1,1)+UP*np.random.uniform(-1,1)) for i in range(0,15)])
2052
+ s.shift(UP).set_color(BLUE)
2053
+ s2= s.copy().set_color(RED)
2054
+ s2.arrange_submobjects()
2055
+ s2.shift(DOWN)
2056
+ self.add(s,s2)
2057
+
2058
+ """
2021
2059
return self .arrange (* args , ** kwargs )
2022
2060
2023
2061
def sort_submobjects (self , * args , ** kwargs ):
2062
+ """Sort the :attr:`submobjects`"""
2024
2063
return self .sort (* args , ** kwargs )
2025
2064
2026
2065
def shuffle_submobjects (self , * args , ** kwargs ):
2066
+ """Shuffles the order of :attr:`submobjects`
2067
+
2068
+ Examples
2069
+ --------
2070
+
2071
+ .. manim:: SuffleSumobjectsExample
2072
+
2073
+ class SuffleSumobjectsExample(Scene):
2074
+ def construct(self):
2075
+ s= VGroup(*[Dot().shift(i*0.1*RIGHT) for i in range(-20,20)])
2076
+ s2= s.copy()
2077
+ s2.shuffle_submobjects()
2078
+ s2.shift(DOWN)
2079
+ self.play(Write(s), Write(s2))
2080
+ """
2027
2081
return self .shuffle (* args , ** kwargs )
2028
2082
2029
2083
# Alignment
0 commit comments