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

Code before:

    def apply_function_to_submobject_positions(self, function):
        for submob in self.submobjects:
            submob.apply_function_to_position(function)
        return self

    def apply_matrix(self, matrix, **kwargs):
        # Default to applying matrix about the origin, not mobjects center
        if ("about_point" not in kwargs) and ("about_edge" not in kwargs):
            kwargs["about_point"] = ORIGIN
        full_matrix = np.identity(self.dim)
        matrix = np.array(matrix)
        full_matrix[: matrix.shape[0], : matrix.shape[1]] = matrix
        self.apply_points_function_about_point(
            lambda points: np.dot(points, full_matrix.T), **kwargs
        )
        return self

    def apply_complex_function(self, function, **kwargs):
        """Complex function that is applied to the xy-plane
        With z= u+iv  u respresents the x value, v represents the y value.

        Example
        -------

        ::manim ApplyFuncExample

            class ApplyFuncExample(Scene):
                def construct(self):
                    circ = Circle().scale(1.5)
                    circ_ref = circ.copy()
                    circ.apply_complex_function(
                        lambda x: np.exp(x*1j)
                    )
                    t=ValueTracker(0)
                    circ.add_updater(
                        lambda x: x.become(circ_ref.copy().apply_complex_function(
                            lambda x: np.exp(x+t.get_value()*1j)
                        )).set_color(BLUE)
                    )
                    self.add(circ_ref)
                    self.play(TransformFromCopy(circ_ref, circ))
                    self.play(t.animate.set_value(TAU), run_time=3)
        """

        def R3_func(point):
            x, y, z = point
            xy_complex = function(complex(x, y))
            return [xy_complex.real, xy_complex.imag, z]

        return self.apply_function(R3_func)

Review comment (suggestion):
```suggestion
        .. manim:: ApplyFuncExample
```

Code after:

        Default behavior is to scale about the center of the mobject.

        Parameters
        ----------
        scale_factor
            The scaling factor :math:`\alpha`. If :math:`0 < |\alpha| < 1`, the mobject
            will shrink, and for :math:`|\alpha| > 1` it will grow. Furthermore, if :math:`\alpha < 0`,
            the mobject is also flipped.
        kwargs
            Additional keyword arguments passed to :meth:`apply_points_function_about_point`.

        Returns
        -------
        Mobject
            The scaled mobject.

        See also
        --------
        :meth:`move_to`

        """
        if config.renderer == "opengl":
            self.apply_points_function(
                lambda points: scale_factor * points,
                works_on_bounding_box=True,
                **kwargs,
            )
            return self
        else:
            self.apply_points_function_about_point(
                lambda points: scale_factor * points, **kwargs
            )
            return self

    def rotate_about_origin(self, angle, axis=OUT, axes=[]):
        """Rotates the :class:`~.Mobject` about the ORIGIN, which is at [0,0,0]."""
        return self.rotate(angle, axis, about_point=ORIGIN)

    def rotate(
        self,
        angle,
        axis=OUT,
        about_point: Optional[Sequence[float]] = None,
        **kwargs,
    ):
        """Rotates the :class:`~.Mobject` about a certain point."""
        if config.renderer == "opengl":
            rot_matrix_T = rotation_matrix_transpose(angle, axis)
            self.apply_points_function(
                lambda points: np.dot(points, rot_matrix_T), about_point, **kwargs