MCPcopy Index your code
hub / github.com/ManimCommunity/manim / apply_function

Method apply_function

manim/mobject/mobject.py:1437–1457  ·  view source on GitHub ↗
(
        self,
        function: MappingFunction,
        *,
        about_point: Point3DLike | None = None,
        about_edge: Vector3DLike | None = None,
    )

Source from the content-addressed store, hash-verified

1435 return self
1436
1437 def apply_function(
1438 self,
1439 function: MappingFunction,
1440 *,
1441 about_point: Point3DLike | None = None,
1442 about_edge: Vector3DLike | None = None,
1443 ) -> Self:
1444 # Default to applying matrix about the origin, not mobjects center
1445 if about_point is None and about_edge is None:
1446 about_point = ORIGIN
1447
1448 def multi_mapping_function(points: Point3D_Array) -> Point3D_Array:
1449 result: Point3D_Array = np.apply_along_axis(function, 1, points)
1450 return result
1451
1452 self.apply_points_function_about_point(
1453 multi_mapping_function,
1454 about_point,
1455 about_edge,
1456 )
1457 return self
1458
1459 def apply_function_to_position(self, function: MappingFunction) -> Self:
1460 self.move_to(function(self.get_center()))

Callers 6

constructMethod · 0.45
nudgeMethod · 0.45
interpolate_mobjectMethod · 0.45

Tested by

no test coverage detected