Repository: ManimCommunity/manim
File: manim/mobject/mobject.py (Python)

Code before:
        """Moves this :class:`~.Mobject` to the given edge of the screen,
        without affecting its position in the other dimension.

        Returns
        -------
        :class:`.Mobject`
            The newly positioned mobject.

        Examples
        --------

        .. manim:: ToEdgeExample

            class ToEdgeExample(Scene):
                def construct(self):
                    tex_top = Tex("I am at the top!")
                    tex_top.to_edge(UP)
                    tex_side = Tex("I am moving to the side!")
                    c = Circle().shift(2*DOWN)
                    self.add(tex_top, tex_side)
                    self.wait()
                    self.play(
                        tex_side.animate.to_edge(LEFT),
                        c.animate.to_edge(RIGHT, buff=0)
                    )
                    self.wait()
        """
        return self.align_on_border(edge, buff)

    def next_to(
        self,
        mobject_or_point,
        direction=RIGHT,
        buff=DEFAULT_MOBJECT_TO_MOBJECT_BUFFER,
        aligned_edge=ORIGIN,
        submobject_to_align=None,
        index_of_submobject_to_align=None,
        coor_mask=np.array([1, 1, 1]),
    ):
        """Move this :class:`~.Mobject` next to another's :class:`~.Mobject` or coordinate.

        Examples
        --------

        .. manim:: GeometricShapes
            :save_last_frame:

            class GeometricShapes(Scene):
                def construct(self):
                    d = Dot()
                    c = Circle()

Review comment (suggestion):
```suggestion
            class ToEdgeExample(Scene):
                def construct(self):
                    tex_top = Tex("I am at the top!")
                    tex_top.to_edge(UP)
                    tex_side = Tex("I am moving to the side!")
                    c = Circle().shift(2*DOWN)
                    self.add(tex_top, tex_side)
                    tex_side.to_edge(LEFT)
                    c.to_edge(RIGHT, buff=0)
                    
```

Code after:
            class ToCornerExample(Scene):
                def construct(self):
                    c = Circle()
                    c.to_corner(UR)
                    t = Tex("To the corner!")
                    t2 = MathTex("x^3").shift(DOWN)
                    self.add(c,t,t2)
                    t.to_corner(DL, buff=0)
                    t2.to_corner(UL, buff=1.5)
        """
        return self.align_on_border(corner, buff)

    def to_edge(
        self, edge: Vector3 = LEFT, buff: float = DEFAULT_MOBJECT_TO_EDGE_BUFFER
    ) -> Self:
        """Moves this :class:`~.Mobject` to the given edge of the screen,
        without affecting its position in the other dimension.

        Returns
        -------
        :class:`.Mobject`
            The newly positioned mobject.

        Examples
        --------

        .. manim:: ToEdgeExample
            :save_last_frame:

            class ToEdgeExample(Scene):
                def construct(self):
                    tex_top = Tex("I am at the top!")
                    tex_top.to_edge(UP)
                    tex_side = Tex("I am moving to the side!")
                    c = Circle().shift(2*DOWN)
                    self.add(tex_top, tex_side)
                    tex_side.to_edge(LEFT)
                    c.to_edge(RIGHT, buff=0)

        """
        return self.align_on_border(edge, buff)

    def next_to(
        self,
        mobject_or_point: Mobject | Point3D,
        direction: Vector3 = RIGHT,
        buff: float = DEFAULT_MOBJECT_TO_MOBJECT_BUFFER,
        aligned_edge: Vector3 = ORIGIN,
        submobject_to_align: Mobject | None = None,
        index_of_submobject_to_align: int | None = None,
        coor_mask: Vector3 = np.array([1, 1, 1]),