### Install Plugin Template Source: https://docs.manim.community/en/stable/plugins.html Install the `manim-plugintemplate` package from PyPI to use as a starting point for creating your own Manim plugins. ```bash pip install manim-plugintemplate ``` -------------------------------- ### Arrow3D Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/three_d/three_dimensions.html Shows how to create a 3D arrow with a specified start, end, and resolution. Requires importing ThreeDScene, Arrow3D, and ThreeDAxes. ```python class ExampleArrow3D(ThreeDScene): def construct(self): axes = ThreeDAxes() arrow = Arrow3D( start=np.array([0, 0, 0]), end=np.array([2, 2, 2]), resolution=8 ) self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES) self.add(axes, arrow) ``` -------------------------------- ### Rendering TexFontTemplateLibrary Example Scene Source: https://docs.manim.community/en/stable/reference/manim.utils.tex_templates.TexFontTemplates.html Instructions to run an example scene that showcases various advanced TeX font templates. This requires the Manim installation and the specified Python script. ```bash manim path/to/manim/example_scenes/advanced_tex_fonts.py TexFontTemplateLibrary -p -ql ``` -------------------------------- ### Animation Setup Scene Method Source: https://docs.manim.community/en/stable/_modules/manim/animation/animation.html Sets up the scene before the animation starts, typically by adding the animation's mobject to the scene if it's an introducer. ```python def _setup_scene(self, scene: Scene) -> None: """Setup up the :class:`~.Scene` before starting the animation. This includes to :meth:`~.Scene.add` the Animation's :class:`~.Mobject` if the animation is an introducer. ``` -------------------------------- ### Linear Transformation Scene Example Source: https://docs.manim.community/en/stable/_modules/manim/scene/vector_space_scene.html Demonstrates applying a linear transformation using a matrix. Includes setup for coordinates and ghost vectors. ```python class LinearTransformationSceneExample(LinearTransformationScene): def __init__(self, **kwargs): LinearTransformationScene.__init__( self, show_coordinates=True, leave_ghost_vectors=True, **kwargs ) def construct(self): matrix = [[1, 1], [0, 1]] self.apply_matrix(matrix) self.wait() ``` -------------------------------- ### Get Table Entries Example Source: https://docs.manim.community/en/stable/reference/manim.mobject.table.Table.html Demonstrates how to retrieve all entries from a table and color them individually. It also shows how to rotate a specific entry. ```python from manim import * class GetEntriesExample(Scene): def construct(self): table = Table( [['First', 'Second'], ['Third','Fourth']], row_labels=[Text('R1'), Text('R2')], col_labels=[Text('C1'), Text('C2')]) ent = table.get_entries() for item in ent: item.set_color(random_bright_color()) table.get_entries((2,2)).rotate(PI) self.add(table) ``` -------------------------------- ### Regular Polygon Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/geometry/polygram.html Demonstrates the creation of regular polygons with different numbers of sides and starting angles. Use this to visualize basic regular polygons. ```python class RegularPolygonExample(Scene): def construct(self): poly_1 = RegularPolygon(n=6) poly_2 = RegularPolygon(n=6, start_angle=30*DEGREES, color=GREEN) poly_3 = RegularPolygon(n=10, color=RED) poly_group = Group(poly_1, poly_2, poly_3).scale(1.5).arrange(buff=1) self.add(poly_group) ``` -------------------------------- ### setup Source: https://docs.manim.community/en/stable/_modules/manim/scene/vector_space_scene.html Sets up the scene by initializing various mobject groups and the background plane. ```APIDOC ## setup ### Description Sets up the scene by initializing various mobject groups and the background plane. ### Method None ### Endpoint None ### Parameters None ### Request Example None ### Response None ``` -------------------------------- ### MarkupText Instantiation Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/text/text_mobject.html Shows a basic example of creating a MarkupText object. This is a simple instantiation and does not require special setup. ```python >>> MarkupText('The horse does not eat cucumber salad.') MarkupText('The horse does not eat cucumber salad.') ``` -------------------------------- ### Render Scene and Preview Source: https://docs.manim.community/en/stable/guides/configuration.html This example demonstrates rendering a scene and automatically opening the video after rendering using the `-p` flag. ```bash manim -p SceneName ``` -------------------------------- ### Scene.setup Source: https://docs.manim.community/en/stable/_modules/manim/scene/scene.html This method is intended for implementation by subclasses to perform common setup tasks before the construct method is called. ```APIDOC ## Scene.setup ### Description This method is intended for implementation by subclasses to perform common setup tasks before the construct method is called. ### Method ```python def setup(self) -> None: pass ``` ``` -------------------------------- ### Get Family Example Source: https://docs.manim.community/en/stable/reference/manim.mobject.mobject.Mobject.html Shows how to get all mobjects in a hierarchy, including the mobject itself and its submobjects, using get_family(). Requires importing Manim. ```python from manim import Square, Rectangle, VGroup, Group, Mobject, VMobject s, r, m, v = Square(), Rectangle(), Mobject(), VMobject() vg = VGroup(s, r) gr = Group(vg, m, v) gr.get_family() ``` -------------------------------- ### Get Highlighted Table Cell Example Source: https://docs.manim.community/en/stable/reference/manim.mobject.table.Table.html Illustrates how to get a highlighted background rectangle for a specific table cell. The highlight color can be customized. ```python from manim import * class GetHighlightedCellExample(Scene): def construct(self): table = Table( [['First', 'Second'], ['Third','Fourth']], row_labels=[Text('R1'), Text('R2')], col_labels=[Text('C1'), Text('C2')]) highlight = table.get_highlighted_cell((2,2), color=GREEN) table.add_to_back(highlight) self.add(table) ``` -------------------------------- ### Basic Scene Rendering Example Source: https://docs.manim.community/en/stable/guides/configuration.html Renders a scene named `SceneOne` from `file.py` with medium quality using the `-qm` flag. ```bash manim -qm file.py SceneOne ``` -------------------------------- ### Get Vertices of Polygram Source: https://docs.manim.community/en/stable/reference/manim.mobject.geometry.polygram.Polygram.html Demonstrates how to get all vertices of a Polygram, which can be useful for geometric calculations or manipulations. This example uses a Square, which is a type of Polygram. ```python >>> sq = Square() >>> sq.get_vertices() array([[ 1., 1., 0.], [-1., 1., 0.], [-1., -1., 0.], [ 1., -1., 0.]]) ``` -------------------------------- ### begin Source: https://docs.manim.community/en/stable/_modules/manim/animation/animation.html Prepares the animation for playback by setting up the initial state and suspending mobject updates if configured. ```APIDOC ## begin ### Description Begins the animation. This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method. ### Method `begin()` ### Returns None ``` -------------------------------- ### Get Y Axis Label Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/graphing/coordinate_systems.html Demonstrates how to get and display a label for the y-axis of a 3D coordinate system. Requires importing ThreeDScene and ThreeDAxes. ```python class GetYAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_y_axis_label(Tex("$y$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab) ``` -------------------------------- ### setup Source: https://docs.manim.community/en/stable/reference/manim.scene.vector_space_scene.LinearTransformationScene.html Provides a common setup method for scenes that are commonly subclassed. ```APIDOC ## setup ### Description This is meant to be implemented by any scenes which are commonly subclassed, and have some common setup involved before the construct method is called. ### Return Type None ``` -------------------------------- ### LinearTransformationScene.setup Source: https://docs.manim.community/en/stable/reference/manim.scene.vector_space_scene.LinearTransformationScene.html Sets up the scene for linear transformations. ```APIDOC ## LinearTransformationScene.setup ### Description Sets up the scene for linear transformations. ### Method `setup()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Get Secant Slope Group Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/graphing/coordinate_systems.html Demonstrates how to get a group of lines and labels representing the secant slope of a graph at a specific point. ```python class GetSecantSlopeGroupExample(Scene): def construct(self): ax = Axes(y_range=[-1, 7]) graph = ax.plot(lambda x: 1 / 4 * x ** 2, color=BLUE) slopes = ax.get_secant_slope_group( x=2.0, graph=graph, dx=1.0, dx_label=Tex("dx = 1.0"), dy_label="dy", dx_line_color=GREEN_B, secant_line_length=4, secant_line_color=RED_D, ) self.add(ax, graph, slopes) ``` -------------------------------- ### Get Starting and Ending Points of Mobject Stroke Source: https://docs.manim.community/en/stable/_modules/manim/mobject/mobject.html Returns a tuple containing the starting and ending points (Point3D) of the stroke that forms the Mobject. ```python return self.get_start(), self.get_end() ``` -------------------------------- ### _setup_scene Source: https://docs.manim.community/en/stable/_modules/manim/animation/animation.html Sets up the scene before the animation starts, adding the mobject if the animation is an introducer. ```APIDOC ## _setup_scene ### Description Sets up the :class:`~.Scene` before starting the animation. This includes to :meth:`~.Scene.add` the Animation's :class:`~.Mobject` if the animation is an introducer. ### Method `_setup_scene(scene: Scene)` ### Parameters * **scene** (Scene) - The scene to set up. ### Returns None ``` -------------------------------- ### Scene.setup Source: https://docs.manim.community/en/stable/_modules/manim/scene/scene.html Sets up the scene before rendering. This method is called internally before the construct method. ```APIDOC ## Scene.setup ### Description Sets up the scene before rendering. This method is called internally before the construct method. ### Method Scene.setup ### Parameters None ``` -------------------------------- ### Get Starting Point of Mobject Stroke Source: https://docs.manim.community/en/stable/_modules/manim/mobject/mobject.html Returns the starting point (Point3D) of the stroke that forms the Mobject. Raises an error if the Mobject has no points. ```python self.throw_error_if_no_points() return np.array(self.points[0]) ``` -------------------------------- ### Get Start Corner Point of 3D VMobject Source: https://docs.manim.community/en/stable/_modules/manim/mobject/three_d/three_d_utils.html Retrieves the coordinates of the start corner of a 3D VMobject. Returns ORIGIN if the VMobject has no points. ```python def get_3d_vmob_start_corner(vmob: VMobject) -> Point3D: if vmob.get_num_points() == 0: return np.array(ORIGIN) return vmob.points[get_3d_vmob_start_corner_index(vmob)] ``` -------------------------------- ### Install Manim with Pixi Source: https://docs.manim.community/en/stable/installation/conda.html Initialize a new project with Pixi and add Manim as a dependency. ```bash pixi init pixi add manim ``` -------------------------------- ### Get Start Corner Index for 3D VMobject Source: https://docs.manim.community/en/stable/_modules/manim/mobject/three_d/three_d_utils.html Returns the index of the start corner for a 3D VMobject. This is consistently 0 for all 3D VMobjects. ```python def get_3d_vmob_start_corner_index(vmob: VMobject) -> Literal[0]: return 0 ``` -------------------------------- ### Setting Background Color via manim.cfg Source: https://docs.manim.community/en/stable/_modules/manim/_config/utils.html Provides an example of how to configure the background color by creating a 'manim.cfg' file in the project directory. ```text [CLI] background_color = WHITE ``` -------------------------------- ### Inverse Interpolation Example (Float) Source: https://docs.manim.community/en/stable/reference/manim.utils.bezier.html Determines the alpha value for a given value between a start and end float. Requires the start, end, and target value. ```python >>> inverse_interpolate(start=2, end=6, value=4) np.float64(0.5) ``` -------------------------------- ### get_3d_vmob_start_corner_index Source: https://docs.manim.community/en/stable/_modules/manim/mobject/three_d/three_d_utils.html Gets the index of the starting corner point for a 3D VMobject. ```APIDOC ## get_3d_vmob_start_corner_index ### Description Returns the index of the starting corner point of a 3D VMobject. This is consistently 0. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **vmob** (VMobject) - The 3D VMobject. ### Returns - **Literal[0]** - The index of the start corner, which is always 0. ``` -------------------------------- ### SampleSpace Mobject Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/graphing/probability.html Demonstrates the creation and basic manipulation of the SampleSpace mobject. Shows how to create SampleSpaces with different sizes, stroke widths, and fill opacities, and how to arrange them. ```python class ExampleSampleSpace(Scene): def construct(self): poly1 = SampleSpace(stroke_width=15, fill_opacity=1) poly2 = SampleSpace(width=5, height=3, stroke_width=5, fill_opacity=0.5) poly3 = SampleSpace(width=2, height=2, stroke_width=5, fill_opacity=0.1) poly3.divide_vertically(p_list=np.array([0.37, 0.13, 0.5]), colors=[BLACK, WHITE, GRAY], vect=RIGHT) poly_group = VGroup(poly1, poly2, poly3).arrange() self.add(poly_group) ``` -------------------------------- ### Basic Scene Construction Example Source: https://docs.manim.community/en/stable/_modules/manim/scene/scene.html This is a fundamental example demonstrating how to create a custom scene by overriding the `construct` method. It shows how to add a simple text object to the scene using the `Write` animation. ```python class MyScene(Scene): def construct(self): self.play(Write(Text("Hello World!"))) ``` -------------------------------- ### Get Y-Axis Label Example Source: https://docs.manim.community/en/stable/reference/manim.mobject.graphing.coordinate_systems.ThreeDAxes.html Demonstrates how to get and add a label to the y-axis of a ThreeDAxes object. Requires importing Manim and defining a class that inherits from ThreeDScene. ```python from manim import * class GetYAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_y_axis_label(Tex("$y$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab) ``` -------------------------------- ### PMobject Example with PointCloudDot and PGroup Source: https://docs.manim.community/en/stable/_modules/manim/mobject/types/point_cloud_mobject.html Demonstrates the creation and arrangement of PMobjects using PointCloudDot and PGroup. Shows how to thin out points and organize them in a grid. ```python class PMobjectExample(Scene): def construct(self): pG = PGroup() # This is just a collection of PMobject's # As the scale factor increases, the number of points # removed increases. for sf in range(1, 9 + 1): p = PointCloudDot(density=20, radius=1).thin_out(sf) # PointCloudDot is a type of PMobject # and can therefore be added to a PGroup pG.add(p) # This organizes all the shapes in a grid. pG.arrange_in_grid() self.add(pG) ``` -------------------------------- ### Get X Axis Label Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/graphing/coordinate_systems.html Demonstrates how to get and add a label for the x-axis of an Axes object. The label is positioned using edge and direction parameters. ```python class GetXAxisLabelExample(Scene): def construct(self): ax = Axes(x_range=(0, 8), y_range=(0, 5), x_length=8, y_length=5) x_label = ax.get_x_axis_label( Tex("$x$-values").scale(0.65), edge=DOWN, direction=DOWN, buff=0.5 ) self.add(ax, x_label) ``` -------------------------------- ### Build documentation locally Source: https://docs.manim.community/en/stable/contributing/development.html Generates the documentation HTML files to verify formatting and Sphinx errors. ```bash make html ``` -------------------------------- ### Getting Start Anchors of Bezier Curves Source: https://docs.manim.community/en/stable/_modules/manim/mobject/types/vectorized_mobject.html Extracts the starting anchor points for all cubic Bezier curves within a VMobject. Returns a Point3D_Array containing these points. ```python def get_start_anchors(self) -> Point3D_Array: """Returns the start anchors of the bezier curves. Returns ------- Point3D_Array Starting anchors """ return self.points[:: self.n_points_per_cubic_curve] ``` -------------------------------- ### VectorizedPoint Location Methods Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/types/vectorized_mobject.html Demonstrates how to get and set the location of a VectorizedPoint. ```python location = vp.get_location() vp.set_location([3, 4, 0]) ``` -------------------------------- ### ZoomedScene Setup Method Source: https://docs.manim.community/en/stable/_modules/manim/scene/zoomed_scene.html Internal method for setting up the ZoomedScene, including initializing the zoomed camera and display mobject, and configuring their properties. ```python def setup(self) -> None: """This method is used internally by Manim to setup the scene for proper use. """ super().setup() # Initialize camera and display zoomed_camera = MovingCamera(**self.zoomed_camera_config) zoomed_display = ImageMobjectFromCamera( zoomed_camera, **self.zoomed_camera_image_mobject_config ) zoomed_display.add_display_frame() for mob in zoomed_camera.frame, zoomed_display: mob.stretch_to_fit_height(self.zoomed_display_height) mob.stretch_to_fit_width(self.zoomed_display_width) zoomed_camera.frame.scale(self.zoom_factor) # Position camera and display zoomed_camera.frame.move_to(self.zoomed_camera_frame_starting_position) if self.zoomed_display_center is not None: zoomed_display.move_to(self.zoomed_display_center) else: zoomed_display.to_corner( self.zoomed_display_corner, buff=self.zoomed_display_corner_buff, ) ``` -------------------------------- ### VDict Get All Submobjects Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/types/vectorized_mobject.html Demonstrates how to retrieve all submobjects associated with a VDict. ```python for submob in my_dict.get_all_submobjects(): self.play(Create(submob)) ``` -------------------------------- ### User-Wide Configuration Example Source: https://docs.manim.community/en/stable/guides/configuration.html Example of a user-wide configuration file. This file sets output file name, GIF saving preference, and background color. ```ini # user-wide [CLI] output_file = myscene save_as_gif = True background_color = WHITE ``` -------------------------------- ### get_3d_vmob_gradient_start_and_end_points Source: https://docs.manim.community/en/stable/_modules/manim/mobject/three_d/three_d_utils.html Gets the start and end points for gradient calculations on a 3D VMobject. ```APIDOC ## get_3d_vmob_gradient_start_and_end_points ### Description Returns a tuple containing the starting and ending points of a 3D VMobject, typically used for gradient calculations. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **vmob** (VMobject) - The 3D VMobject for which to get the gradient points. ### Returns - **tuple[Point3D, Point3D]** - A tuple containing the start and end points. ``` -------------------------------- ### Inverse Interpolation Example (Point3D) Source: https://docs.manim.community/en/stable/reference/manim.utils.bezier.html Determines the alpha value for a given Point3D value between start and end Point3D objects. Requires the start, end, and target value. ```python >>> start = np.array([1, 2, 1]) >>> end = np.array([7, 8, 11]) >>> value = np.array([4, 5, 5]) >>> inverse_interpolate(start, end, value) array([0.5, 0.5, 0.4]) ``` -------------------------------- ### SpinInFromNothing Example Source: https://docs.manim.community/en/stable/reference/manim.animation.growing.SpinInFromNothing.html Demonstrates how to use SpinInFromNothing with default settings, a specified angle, and a specified initial color. ```python from manim import * class SpinInFromNothingExample(Scene): def construct(self): squares = [Square() for _ in range(3)] VGroup(*squares).set_x(0).arrange(buff=2) self.play(SpinInFromNothing(squares[0])) self.play(SpinInFromNothing(squares[1], angle=2 * PI)) self.play(SpinInFromNothing(squares[2], point_color=RED)) ``` -------------------------------- ### Rotate Mobject Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/mobject.html Demonstrates rotating mobjects around a specified point. The example shows rotating a group of mobjects, including an arrow, around the start of the arrow. ```python class RotateMethodExample(Scene): def construct(self): circle = Circle(radius=1, color=BLUE) line = Line(start=ORIGIN, end=RIGHT) arrow1 = Arrow(start=ORIGIN, end=RIGHT, buff=0, color=GOLD) group1 = VGroup(circle, line, arrow1) group2 = group1.copy() arrow2 = group2[2] arrow2.rotate(angle=PI / 4, about_point=arrow2.get_start()) group3 = group1.copy() arrow3 = group3[2] arrow3.rotate(angle=120 * DEGREES, about_point=arrow3.get_start()) self.add(VGroup(group1, group2, group3).arrange(RIGHT, buff=1)) ``` -------------------------------- ### Folder-Wide Configuration Example Source: https://docs.manim.community/en/stable/guides/configuration.html Example of a folder-wide configuration file. This file overrides the save_as_gif setting from the user-wide file. ```ini # folder-wide [CLI] save_as_gif = False ``` -------------------------------- ### Get Labels Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/table.html Demonstrates retrieving all labels (row, column, and top-left entry if present) from a table and coloring them individually. This example colors each label with a distinct color. ```python class GetLabelsExample(Scene): def construct(self): table = Table( [['First', 'Second'], ['Third','Fourth']], row_labels=[Text('R1'), Text('R2')], col_labels=[Text('C1'), Text('C2')]) lab = table.get_labels() colors = [BLUE, GREEN, YELLOW, RED] for k in range(len(colors)): lab[k].set_color(colors[k]) self.add(table) ``` -------------------------------- ### Create Starting Mobject Source: https://docs.manim.community/en/stable/_modules/manim/animation/animation.html Returns a copy of the mobject to serve as the starting point for the animation. ```python def create_starting_mobject(self) -> Mobject | OpenGLMobject: # Keep track of where the mobject starts return self.mobject.copy() ``` -------------------------------- ### ManimMagic Render Help Command Example Source: https://docs.manim.community/en/stable/reference/manim.utils.ipython_magic.ManimMagic.html Shows how to access the command-line interface help specifically for the `render` subcommand of the `%%manim` magic command. This provides detailed options for rendering. ```bash %manim render --help ``` -------------------------------- ### Get Unit Normal at Start Corner of 3D VMobject Source: https://docs.manim.community/en/stable/_modules/manim/mobject/three_d/three_d_utils.html Retrieves the unit normal vector at the start corner of a 3D VMobject. This is a convenience function that calls get_3d_vmob_unit_normal. ```python def get_3d_vmob_start_corner_unit_normal(vmob: VMobject) -> Vector3D: return get_3d_vmob_unit_normal(vmob, get_3d_vmob_start_corner_index(vmob)) ``` -------------------------------- ### Install Manim on Windows Source: https://docs.manim.community/en/stable/installation/uv.html Initializes a new Python project directory and adds Manim as a dependency, installing it into the local environment. This is the recommended procedure for Windows users. ```bash uv init manimations cd manimations uv add manim ``` -------------------------------- ### Manim Line put_start_and_end_on Method Example Source: https://docs.manim.community/en/stable/reference/manim.mobject.geometry.line.Line.html Illustrates the use of the put_start_and_end_on method to dynamically change the start and end points of a Line object. The example visualizes these changes over time. ```python from manim import * class LineExample(Scene): def construct(self): d = VGroup() for i in range(0,10): d.add(Dot()) d.arrange_in_grid(buff=1) self.add(d) l= Line(d[0], d[1]) self.add(l) self.wait() l.put_start_and_end_on(d[1].get_center(), d[2].get_center()) self.wait() l.put_start_and_end_on(d[4].get_center(), d[7].get_center()) self.wait() ``` -------------------------------- ### Get Table Entries Without Labels Example Source: https://docs.manim.community/en/stable/reference/manim.mobject.table.Table.html Shows how to get table entries excluding labels and apply different colors to each. It also demonstrates rotating a specific entry. ```python from manim import * class GetEntriesWithoutLabelsExample(Scene): def construct(self): table = Table( [['First', 'Second'], ['Third','Fourth']], row_labels=[Text('R1'), Text('R2')], col_labels=[Text('C1'), Text('C2')]) ent = table.get_entries_without_labels() colors = [BLUE, GREEN, YELLOW, RED] for k in range(len(colors)): ent[k].set_color(colors[k]) table.get_entries_without_labels((2,2)).rotate(PI) self.add(table) ``` -------------------------------- ### Animation Begin Method Source: https://docs.manim.community/en/stable/_modules/manim/animation/animation.html Initializes the animation, creates the starting mobject, suspends mobject updating if configured, and interpolates to the initial state (0). ```python def begin(self) -> None: """Begin the animation. This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method. """ self.starting_mobject = self.create_starting_mobject() if self.suspend_mobject_updating: # All calls to self.mobject's internal updaters # during the animation, either from this Animation # or from the surrounding scene, should do nothing. # It is, however, okay and desirable to call # the internal updaters of self.starting_mobject, # or any others among self.get_all_mobjects() self.mobject.suspend_updating() self.interpolate(0) ``` -------------------------------- ### Manim Table: Get Highlighted Cell Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/table.html Shows how to get a highlighted background rectangle for a specific cell in a Manim Table. The highlight is applied using a specified color. ```python class GetHighlightedCellExample(Scene): def construct(self): table = Table( [['First', 'Second'], ['Third','Fourth']], row_labels=[Text('R1'), Text('R2')], col_labels=[Text('C1'), Text('C2')]) highlight = table.get_highlighted_cell((2,2), color=GREEN) table.add_to_back(highlight) self.add(table) ``` -------------------------------- ### Matrix Examples Source: https://docs.manim.community/en/stable/_modules/manim/mobject/matrix.html Demonstrates the creation and arrangement of different matrix types: Matrix, IntegerMatrix, DecimalMatrix, and MobjectMatrix. This example showcases various customization options for brackets and element formatting. ```python class MatrixExamples(Scene): def construct(self): m0 = Matrix([["\\pi", 0], [-1, 1]]) m1 = IntegerMatrix([[1.5, 0.], [12, -1.3]], left_bracket="(", right_bracket=")") m2 = DecimalMatrix( [[3.456, 2.122], [33.2244, 12.33]], element_to_mobject_config={\"num_decimal_places\": 2}, left_bracket=r"\\{", right_bracket=r"\\}") m3 = MobjectMatrix( [[Circle().scale(0.3), Square().scale(0.3)], [MathTex(\"\\pi\").scale(2), Star().scale(0.3)]], left_bracket="\\langle", right_bracket="\\rangle") g = Group(m0, m1, m2, m3).arrange_in_grid(buff=2) self.add(g) ``` -------------------------------- ### Manim Toy Example Scene Source: https://docs.manim.community/en/stable/guides/deep_dive.html A basic Manim scene demonstrating mobject creation, transformations, updaters, and animations. This example is used throughout the guide to explain the rendering pipeline. ```python from manim import * class ToyExample(Scene): def construct(self): orange_square = Square(color=ORANGE, fill_opacity=0.5) blue_circle = Circle(color=BLUE, fill_opacity=0.5) self.add(orange_square) self.play(ReplacementTransform(orange_square, blue_circle, run_time=3)) small_dot = Dot() small_dot.add_updater(lambda mob: mob.next_to(blue_circle, DOWN)) self.play(Create(small_dot)) self.play(blue_circle.animate.shift(RIGHT)) self.wait() self.play(FadeOut(blue_circle, small_dot)) ``` -------------------------------- ### Install Full TeX Live Distribution on Fedora Source: https://docs.manim.community/en/stable/installation/uv.html Installs the complete TeX Live distribution using the dnf package manager. This is recommended for a full LaTeX setup on Fedora systems. ```bash sudo dnf install texlive-scheme-full ``` -------------------------------- ### Basic Table Creation and Styling Source: https://docs.manim.community/en/stable/_modules/manim/mobject/table.html Demonstrates creating a basic table with custom row/column labels and a top-left entry. It also shows how to highlight a specific cell. ```python t0 = Table( [["First", "Second"], ["Third","Fourth"]], row_labels=[Text("R1"), Text("R2")], col_labels=[Text("C1"), Text("C2")], top_left_entry=Text("TOP")) t0.add_highlighted_cell((2,2), color=GREEN) ``` -------------------------------- ### Manim Table: Get Rows Example Source: https://docs.manim.community/en/stable/_modules/manim/mobject/table.html Demonstrates how to get all rows of a Manim Table as a VGroup of VGroups. This method is helpful for operations that affect entire rows, such as adding background rectangles. ```python class GetRowsExample(Scene): def construct(self): table = Table( [['First', 'Second'], ['Third','Fourth']], row_labels=[Text('R1'), Text('R2')], col_labels=[Text('C1'), Text('C2')]) table.add(SurroundingRectangle(table.get_rows()[1])) self.add(table) ``` -------------------------------- ### Executing Manim with a Configuration File Source: https://docs.manim.community/en/stable/_modules/manim/_config/utils.html Demonstrates the command-line execution of Manim, showing how the 'manim.cfg' file influences the scene's background color. ```bash manim scene.py ``` -------------------------------- ### PMobject Example Source: https://docs.manim.community/en/stable/reference/manim.mobject.types.point_cloud_mobject.PMobject.html Demonstrates the creation and arrangement of PMobject instances using PointCloudDot and PGroup. The thin_out method is used to control point density based on a scale factor. ```python from manim import * class PMobjectExample(Scene): def construct(self): pG = PGroup() # This is just a collection of PMobject's # As the scale factor increases, the number of points # removed increases. for sf in range(1, 9 + 1): p = PointCloudDot(density=20, radius=1).thin_out(sf) # PointCloudDot is a type of PMobject # and can therefore be added to a PGroup pG.add(p) # This organizes all the shapes in a grid. pG.arrange_in_grid() self.add(pG) ``` -------------------------------- ### Get Gradient Start and End Points for 3D VMobject Source: https://docs.manim.community/en/stable/_modules/manim/mobject/three_d/three_d_utils.html Retrieves the start and end corner points of a 3D VMobject. Useful for defining gradient ranges or bounding box calculations. ```python def get_3d_vmob_gradient_start_and_end_points( vmob: VMobject, ) -> tuple[Point3D, Point3D]: return ( get_3d_vmob_start_corner(vmob), get_3d_vmob_end_corner(vmob), ) ``` -------------------------------- ### Example Folder-Wide Configuration File Source: https://docs.manim.community/en/stable/guides/configuration.html This is an example of a `manim.cfg` file that can be placed in the same directory as your scene code. It uses the `[CLI]` section to define output file name, GIF saving, and background color. ```ini [CLI] # my config file output_file = myscene save_as_gif = True background_color = WHITE ``` -------------------------------- ### Install Full TeX Live Distribution on Debian-based Systems Source: https://docs.manim.community/en/stable/installation/uv.html Installs the complete TeX Live distribution using the apt package manager. This is recommended for a full LaTeX setup on Debian-based Linux systems. ```bash sudo apt install texlive-full ``` -------------------------------- ### Get Mobject Color Source: https://docs.manim.community/en/stable/_modules/manim/mobject/mobject.html Retrieves the current color of the Mobject. Includes an example demonstrating its usage with a Square. ```python def get_color(self) -> ManimColor: """Returns the color of the :class:`~.Mobject` Examples -------- :: >>> from manim import Square, RED >>> Square(color=RED).get_color() == RED True """ return self.color ``` -------------------------------- ### Line Initialization and Buffering Source: https://docs.manim.community/en/stable/_modules/manim/mobject/geometry/line.html Demonstrates creating a line with a buffer space between its start and end points. The buffer ensures a minimum distance, preventing the line from becoming too short. ```python class LineExample(Scene): def construct(self): d = VGroup() for i in range(0,10): d.add(Dot()) d.arrange_in_grid(buff=1) self.add(d) l= Line(d[0], d[1]) self.add(l) self.wait() l.put_start_and_end_on(d[1].get_center(), d[2].get_center()) self.wait() l.put_start_and_end_on(d[4].get_center(), d[7].get_center()) self.wait() ``` -------------------------------- ### Example of Getting Axis Labels Source: https://docs.manim.community/en/stable/_modules/manim/mobject/graphing/coordinate_systems.html Demonstrates how to retrieve and display labels for the axes of a 3D coordinate system. ```python class GetAxisLabelsExample(ThreeDScene): def construct(self): self.set_camera_orientation(phi=2*PI/5, theta=PI/5) axes = ThreeDAxes() labels = axes.get_axis_labels( Text("x-axis").scale(0.7), Text("y-axis").scale(0.45), Text("z-axis").scale(0.45) ) self.add(axes, labels) ``` -------------------------------- ### Manim Line Initialization Example Source: https://docs.manim.community/en/stable/reference/manim.mobject.geometry.line.Line.html Demonstrates the creation of Line objects with different parameters: default, with buffer, and with a path arc. Lines are arranged vertically for visualization. ```python from manim import * class LineExample(Scene): def construct(self): line1 = Line(LEFT*2, RIGHT*2) line2 = Line(LEFT*2, RIGHT*2, buff=0.5) line3 = Line(LEFT*2, RIGHT*2, path_arc=PI/2) grp = VGroup(line1,line2,line3).arrange(DOWN, buff=2) self.add(grp) ``` -------------------------------- ### Initialize a New Manim Project Source: https://docs.manim.community/en/stable/tutorials/quickstart.html Use this command to create a new Manim project directory with default configuration files. ```bash manim init project my-project --default ```