Skip to content

Ready-made scenes

The film's code
import manimgx as m


class ReadyMadeScenesHero(m.LinearTransformationScene):
    def construct(self) -> None:
        self.add_vector([1, 2], color=m.YELLOW)
        self.apply_matrix([[1, 1], [0, 1]])
        self.wait()

These scenes come with what one kind of video needs. A vector scene draws vectors from the origin of a plane, with their labels and their coordinates. A linear transformation scene applies a matrix to the plane and to everything on it, in one play. A zoomed scene shows a magnified part of the frame, in an inset.

VectorScene

Code
import manimgx as m


class VectorSceneExample(m.VectorScene):
    def construct(self) -> None:
        self.add_plane()
        vector = self.add_vector([3, 2], color=m.YELLOW)
        self.write_vector_coordinates(vector)
        self.wait()

A scene for drawing vectors: arrows from the origin, their labels and their coordinates.

Its methods add a plane and axes, draw vectors and label them, and animate the passage from a vector to its coordinates and back. add_vector draws a vector from the origin, in scene units; get_vector makes one in the coordinates of the scene's plane.

class MyScene(m.VectorScene):
basis_vector_stroke_width

The stroke width of the basis vectors (see get_basis_vectors), in hundredths of a scene unit.

Source

src/manimgx/scene.py

def __init__(self, basis_vector_stroke_width: float = 6.0) -> None:
    super().__init__()
    self.basis_vector_stroke_width = basis_vector_stroke_width

plane

The plane whose coordinates get_vector reads: a LinearTransformationScene makes it; in a vector scene, assign it (self.plane = self.add_plane()).

grows_vectors

Whether add_vector shows a vector growing unless told otherwise: True in a vector scene, False in a transformation scene.

add_plane

Add a number plane to the scene.

self.add_plane(animate=False, **kwargs)
animate

Whether to draw it in (Create, its lines overlapping).

It also takes the NumberPlane keywords.

Returns The plane. It is not the scene's plane unless assigned to it.

Source

src/manimgx/scene.py

def add_plane(
    self, animate: bool = False, **kwargs: Unpack[NumberPlaneOptions]
) -> NumberPlane:
    """Add a number plane to the scene.

    Args:
        animate: Whether to draw it in ([`Create`][manimgx.Create], its lines
            overlapping).
        **kwargs: [Number plane keywords][manimgx.NumberPlane].

    Returns:
        The plane. It is not the scene's [`plane`][manimgx.VectorScene.plane] unless
        assigned to it.
    """
    plane = NumberPlane(**kwargs)
    if animate:
        self.play(Create(plane, lag_ratio=0.5))
    self.add(plane)
    return plane

add_axes

Add axes to the scene, one scene unit to one unit.

self.add_axes(animate=False, color=WHITE)
animate

Whether to draw them in (Create).

color

Their color.

Returns The axes.

Source

src/manimgx/scene.py

def add_axes(self, animate: bool = False, color: Colors = WHITE) -> Axes:
    """Add axes to the scene, one scene unit to one unit.

    Args:
        animate: Whether to draw them in ([`Create`][manimgx.Create]).
        color: Their color.

    Returns:
        The axes.
    """
    axes = Axes(color=color, axis_config={"unit_size": 1})
    if animate:
        self.play(Create(axes))
    self.add(axes)
    return axes

get_vector

Make an arrow from the origin of the scene's plane to a point given in its coordinates.

self.get_vector(numerical_vector, **kwargs)
numerical_vector

The point's coordinates on plane: x and y (a z is ignored).

It also takes the Arrow keywords.

Returns A new arrow, not added to the scene.

Source

src/manimgx/scene.py

def get_vector(
    self, numerical_vector: Vector3DLike, **kwargs: Unpack[ArrowTips]
) -> Arrow:
    """Make an arrow from the origin of the scene's plane to a point given in its
    coordinates.

    Args:
        numerical_vector: The point's coordinates on
            [`plane`][manimgx.VectorScene.plane]: x and y (a z is ignored).
        **kwargs: [Arrow keywords][manimgx.Arrow].

    Returns:
        A new arrow, not added to the scene.
    """
    x, y = np.asarray(numerical_vector, dtype=float)[:2]
    return Arrow(
        self.plane.coords_to_point(0, 0),
        self.plane.coords_to_point(x, y),
        buff=0,
        **kwargs,
    )

add_vector

Add a vector to the scene: the arrow given, or a Vector from the origin to the coordinates given.

It is shown growing from the origin (GrowArrow) if animate says so, or else if the scene's grows_vectors does (a vector scene's does, a transformation scene's doesn't); then the scene takes it up: a LinearTransformationScene moves it with the plane.

self.add_vector(vector, color=PURE_YELLOW, animate=None, **kwargs)
vector

An arrow, or the coordinates of a vector's tip, in scene units.

color

The vector's color, when it is made from coordinates.

animate

Whether it grows in a play; None for the scene's grows_vectors.

It also takes the Arrow keywords.

Returns The arrow.

Source

src/manimgx/scene.py

def add_vector(
    self,
    vector: Arrow | Vector3DLike,
    color: Colors = PURE_YELLOW,
    animate: bool | None = None,
    **kwargs: Unpack[ArrowTipsBase],
) -> Arrow:
    """Add a vector to the scene: the arrow given, or a [Vector][manimgx.Vector] from
    the origin to the coordinates given.

    It is shown growing from the origin ([GrowArrow][manimgx.GrowArrow]) if `animate`
    says so, or else if the scene's `grows_vectors` does (a vector scene's does, a
    transformation scene's doesn't); then the scene takes it up: a
    [LinearTransformationScene][manimgx.LinearTransformationScene] moves it with the
    plane.

    Args:
        vector: An arrow, or the coordinates of a vector's tip, in scene units.
        color: The vector's color, when it is made from coordinates.
        animate: Whether it grows in a play; None for the scene's `grows_vectors`.
        **kwargs: [Arrow keywords][manimgx.mobjects.shapes.ArrowTipsBase] for
            a vector made from coordinates.

    Returns:
        The arrow.
    """
    if not isinstance(vector, Arrow):
        vector = Vector(np.asarray(vector, dtype=float), color=color, **kwargs)
    if self.grows_vectors if animate is None else animate:
        self.play(GrowArrow(vector))
    self.add(vector)
    self.added_vector(vector)
    return vector

write_vector_coordinates

Write a vector's coordinates beside its tip, as a column (its coordinate_label), in a play of Write.

self.write_vector_coordinates(vector, **kwargs)

It also takes the Matrix keywords.

Returns The column.

Source

src/manimgx/scene.py

def write_vector_coordinates(
    self, vector: Vector, **kwargs: Unpack[MatrixOptions]
) -> Matrix:
    """Write a vector's coordinates beside its tip, as a column (its
    `coordinate_label`), in a play of [`Write`][manimgx.Write].

    Args:
        **kwargs: [Matrix keywords][manimgx.mobjects.grid.MatrixOptions] for the
            column.

    Returns:
        The column.
    """
    coords = vector.coordinate_label(**kwargs)
    self.play(Write(coords))
    return coords

get_basis_vectors

Make the basis vectors î and ĵ: arrows from the origin to (1, 0) and (0, 1), in scene units.

self.get_basis_vectors(i_hat_color=X_COLOR, j_hat_color=Y_COLOR)
i_hat_color

The color of î.

j_hat_color

The color of ĵ.

Returns A new group of the two, î first.

Source

src/manimgx/scene.py

def get_basis_vectors(
    self, i_hat_color: Colors = X_COLOR, j_hat_color: Colors = Y_COLOR
) -> VGroup:
    """Make the basis vectors î and ĵ: arrows from the origin to (1, 0) and (0, 1),
    in scene units.

    Args:
        i_hat_color: The color of î.
        j_hat_color: The color of ĵ.

    Returns:
        A new group of the two, î first.
    """
    return VGroup(
        *(
            Vector(
                np.asarray(vect, dtype=float),
                color=color,
                stroke_width=self.basis_vector_stroke_width,
            )
            for vect, color in [([1, 0], i_hat_color), ([0, 1], j_hat_color)]
        )
    )

get_basis_vector_labels

Make labels for the basis vectors: î and ĵ, in the colors of the x and y axes (green and red).

self.get_basis_vector_labels(**kwargs)
at_tip

Whether the label goes beyond the vector's tip, rather than beside its middle (default False).

direction

Which side of the vector the label goes on, looking along the vector (default "left").

rotate

Whether the label turns with the vector, rather than staying upright (default False).

Returns A new group of the two labels, î's first.

Source

src/manimgx/scene.py

def get_basis_vector_labels(self, **kwargs: Unpack[LabelPlacement]) -> VGroup:
    """Make labels for the basis vectors: î and ĵ, in the colors of the x and y axes
    (green and red).

    Args:
        **kwargs: [Label placement keywords][manimgx.scene.LabelPlacement].

    Returns:
        A new group of the two labels, î's first.
    """
    i_hat, j_hat = self.get_basis_vectors().submobjects
    return VGroup(
        *(
            self.get_vector_label(
                vect, label, color=color, label_scale_factor=1, **kwargs
            )
            for vect, label, color in [
                (i_hat, "\\hat{\\imath}", X_COLOR),
                (j_hat, "\\hat{\\jmath}", Y_COLOR),
            ]
            if isinstance(vect, Vector)
        )
    )

get_vector_label

Make a label for a vector: beside its middle, on its left or its right, or beyond its tip.

A string is typeset as LaTeX, a single letter as a bold vector (\vec{\textbf{v}}), in the vector's color. The label gets a background rectangle, to be read over the lines under it.

self.get_vector_label(vector, label, at_tip=False, direction='left', rotate=False, color=None, label_scale_factor=LARGE_BUFF - 0.2)
vector

The vector, from the origin.

label

The label: a mobject, or LaTeX.

at_tip

Whether it goes beyond the vector's tip, rather than beside its middle.

direction

Which side of the vector it goes on, looking along the vector.

rotate

Whether it turns with the vector, rather than staying upright.

color

Its color, when it is made from a string; None for the vector's.

label_scale_factor

How much it is scaled.

Returns The label, not added to the scene.

Source

src/manimgx/scene.py

def get_vector_label(
    self,
    vector: Vector,
    label: ManimTextLabel | str,
    at_tip: bool = False,
    direction: Literal["left", "right"] = "left",
    rotate: bool = False,
    color: ParsableManimColor | None = None,
    label_scale_factor: float = LARGE_BUFF - 0.2,
) -> ManimTextLabel:
    r"""Make a label for a vector: beside its middle, on its left or its right, or
    beyond its tip.

    A string is typeset as LaTeX, a single letter as a bold vector
    (`\vec{\textbf{v}}`), in the vector's color. The label gets a background
    rectangle, to be read over the lines under it.

    Args:
        vector: The vector, from the origin.
        label: The label: a mobject, or LaTeX.
        at_tip: Whether it goes beyond the vector's tip, rather than beside its
            middle.
        direction: Which side of the vector it goes on, looking along the vector.
        rotate: Whether it turns with the vector, rather than staying upright.
        color: Its color, when it is made from a string; None for the vector's.
        label_scale_factor: How much it is scaled.

    Returns:
        The label, not added to the scene.
    """
    if isinstance(label, str):
        if len(label) == 1:
            label = f"\\vec{{\\textbf{{{label}}}}}"
        label = MathTex(label)
        label.set_color(vector.get_color() if color is None else color)
    label.scale(label_scale_factor)
    label.add_background_rectangle()
    if at_tip:
        vect = vector.get_vector()
        label.next_to(
            vector.get_end(), vect / np.linalg.norm(vect), buff=SMALL_BUFF
        )
    else:
        angle = vector.get_angle()
        if not rotate:
            label.rotate(-angle, about_point=ORIGIN)
        if direction == "left":
            label.shift(-np.asarray(label.get_bottom()) + 0.1 * UP)
        else:
            label.shift(-np.asarray(label.get_top()) + 0.1 * DOWN)
        label.rotate(angle, about_point=ORIGIN)
        label.shift((vector.get_end() - vector.get_start()) / 2)
    return label

label_vector

Label a vector, and add the label to the scene (see get_vector_label).

self.label_vector(vector, label, animate=True, **kwargs)
vector

The vector, from the origin.

label

The label: a mobject, or LaTeX.

animate

Whether to write it in (Write).

color

The label's color, when it is made from a string (default None: the vector's).

label_scale_factor

How much the label is scaled (default 0.8).

at_tip

Whether the label goes beyond the vector's tip, rather than beside its middle (default False).

direction

Which side of the vector the label goes on, looking along the vector (default "left").

rotate

Whether the label turns with the vector, rather than staying upright (default False).

Returns The label.

Source

src/manimgx/scene.py

def label_vector(
    self,
    vector: Vector,
    label: ManimTextLabel | str,
    animate: bool = True,
    **kwargs: Unpack[VectorLabelOptions],
) -> ManimTextLabel:
    """Label a vector, and add the label to the scene (see
    [`get_vector_label`][manimgx.VectorScene.get_vector_label]).

    Args:
        vector: The vector, from the origin.
        label: The label: a mobject, or LaTeX.
        animate: Whether to write it in ([`Write`][manimgx.Write]).
        **kwargs: [Vector label keywords][manimgx.scene.VectorLabelOptions].

    Returns:
        The label.
    """
    mathtex_label = self.get_vector_label(vector, label, **kwargs)
    if animate:
        self.play(Write(mathtex_label, run_time=1))
    self.add(mathtex_label)
    return mathtex_label

vector_to_coords

Show how a vector gives its coordinates, in a series of plays.

The vector (drawn first, when it is given by its coordinates) gets a line along x and a line up to its tip, each written with its coordinate; the coordinates then move into a column beside its tip.

self.vector_to_coords(vector, integer_labels=True, clean_up=True)
vector

The vector, from the origin, or its coordinates.

integer_labels

Whether the coordinates are rounded to integers.

clean_up

Whether the scene is left holding what it held before, at the end.

Returns The column of coordinates, the line along x and the line up to the tip.

Source

src/manimgx/scene.py

def vector_to_coords(
    self,
    vector: Vector | Vector3DLike,
    integer_labels: bool = True,
    clean_up: bool = True,
) -> tuple[Matrix, Line, Line]:
    """Show how a vector gives its coordinates, in a series of plays.

    The vector (drawn first, when it is given by its coordinates) gets a line along
    x and a line up to its tip, each written with its coordinate; the coordinates
    then move into a column beside its tip.

    Args:
        vector: The vector, from the origin, or its coordinates.
        integer_labels: Whether the coordinates are rounded to integers.
        clean_up: Whether the scene is left holding what it held before, at the end.

    Returns:
        The column of coordinates, the line along x and the line up to the tip.
    """
    starting_mobjects = list(self.mobjects)
    show_creation = not isinstance(vector, Vector)
    arrow = vector if isinstance(vector, Vector) else Vector(vector)
    end = arrow.get_end()[:2]
    array = arrow.coordinate_label(integer_labels=integer_labels)
    x_line = Line(ORIGIN, end[0] * RIGHT)
    y_line = Line(x_line.get_end(), arrow.get_end())
    x_line.set_color(X_COLOR)
    y_line.set_color(Y_COLOR)
    x_coord, y_coord = array.get_entries().submobjects[:2]
    x_coord_start = self.position_x_coordinate(x_coord.copy(), x_line, end)
    y_coord_start = self.position_y_coordinate(y_coord.copy(), y_line, end)
    brackets = array.get_brackets()
    if show_creation:
        self.play(Create(arrow))
    self.play(Create(x_line), Write(x_coord_start), run_time=1)
    self.play(Create(y_line), Write(y_coord_start), run_time=1)
    self.wait()
    self.play(
        Transform(x_coord_start, x_coord, lag_ratio=0),
        Transform(y_coord_start, y_coord, lag_ratio=0),
        Write(brackets, run_time=1),
    )
    self.wait()
    self.remove(x_coord_start, y_coord_start, brackets)
    self.add(array)
    if clean_up:
        self.clear()
        self.add(*starting_mobjects)
    return array, x_line, y_line

LinearTransformationScene

Code
import manimgx as m


class LinearTransformationSceneExample(m.LinearTransformationScene):
    def __init__(self) -> None:
        super().__init__(show_coordinates=True, leave_ghost_vectors=True)

    def construct(self) -> None:
        self.add_unit_square()
        self.add_vector([-1, 2], color=m.YELLOW)
        self.apply_matrix([[1, 1], [0, 1]])  # a shear
        self.wait()

A scene for linear transformations of the plane: a matrix applied to the plane and to everything on it, in one animation.

Before construct, it lays a still plane in the background (background_plane), a plane over it that the transformations move (plane), and the basis vectors î and ĵ (i_hat and j_hat, together basis_vectors). apply_matrix then transforms what the scene holds, by kind: the points of the transformable mobjects, as the plane's; the vectors, redrawn to where their tips go; the labels that follow them; and the moving mobjects, moved whole to where their centers go. The background and foreground mobjects stay where they are.

class MyScene(m.LinearTransformationScene):
include_background_plane

Whether a plane stays still in the background.

include_foreground_plane

Whether a plane over it moves with the transformations: the scene's plane.

background_plane_kwargs

Number plane keywords for the background plane, over its own (grey lines).

foreground_plane_kwargs

Number plane keywords for the moving plane, over its own (it reaches past the frame, so that the frame stays covered as it moves).

show_coordinates

Whether the background plane's axes are numbered.

show_basis_vectors

Whether the basis vectors are drawn; they move with the transformations.

basis_vector_stroke_width

The basis vectors' stroke width, in hundredths of a scene unit.

i_hat_color

The color of î.

j_hat_color

The color of ĵ.

leave_ghost_vectors

Whether each transformation leaves faded copies of the vectors where they were.

Source

src/manimgx/scene.py

def __init__(
    self,
    include_background_plane: bool = True,
    include_foreground_plane: bool = True,
    background_plane_kwargs: NumberPlaneOptions | None = None,
    foreground_plane_kwargs: NumberPlaneOptions | None = None,
    show_coordinates: bool = False,
    show_basis_vectors: bool = True,
    basis_vector_stroke_width: float = 6,
    i_hat_color: ParsableManimColor = X_COLOR,
    j_hat_color: ParsableManimColor = Y_COLOR,
    leave_ghost_vectors: bool = False,
) -> None:
    super().__init__()
    self.include_background_plane = include_background_plane
    self.include_foreground_plane = include_foreground_plane
    self.show_coordinates = show_coordinates
    self.show_basis_vectors = show_basis_vectors
    self.basis_vector_stroke_width = basis_vector_stroke_width
    self.i_hat_color = ManimColor(i_hat_color)
    self.j_hat_color = ManimColor(j_hat_color)
    self.leave_ghost_vectors = leave_ghost_vectors
    self.ghost_vectors = VGroup()
    """The faded copies the transformations left of what they moved whole, where it
    was, with `leave_ghost_vectors`."""
    self.background_plane_kwargs = _merged_plane(
        {
            "color": GREY,
            "axis_config": {"color": GREY},
            "background_line_style": {"stroke_color": GREY, "stroke_width": 1},
        },
        background_plane_kwargs,
    )
    self.foreground_plane_kwargs = _merged_plane(
        {
            "x_range": (-config.frame_width, config.frame_width, 1.0),
            "y_range": (-config.frame_width, config.frame_width, 1.0),
            "faded_line_ratio": 1,
        },
        foreground_plane_kwargs,
    )

ghost_vectors

The faded copies the transformations left of what they moved whole, where it was, with leave_ghost_vectors.

setup

Lay out the planes and the basis vectors, and add them to the scene.

render calls it before construct; it acts once. A subclass that overrides it calls this one first.

self.setup()
Source

src/manimgx/scene.py

def setup(self) -> None:
    """Lay out the planes and the basis vectors, and add them to the scene.

    [`render`][manimgx.Scene.render] calls it before `construct`; it acts once. A
    subclass that overrides it calls this one first.
    """
    if hasattr(self, "has_already_setup"):
        return
    self.has_already_setup = True
    self.background_mobjects: list[Mobject] = []
    self.foreground_mobjects: list[Mobject] = []
    self.transformable_mobjects: list[Mobject] = []
    self.moving_vectors: list[Mobject] = []
    self.transformable_labels: list[_TransformableLabel] = []
    self.moving_mobjects: list[Mobject] = []
    self.background_plane = NumberPlane(**self.background_plane_kwargs)
    if self.show_coordinates:
        self.background_plane.add_coordinates()
    if self.include_background_plane:
        self.add_background_mobject(self.background_plane)
    if self.include_foreground_plane:
        self.plane = NumberPlane(**self.foreground_plane_kwargs)
        self.add_transformable_mobject(self.plane)
    if self.show_basis_vectors:
        self.basis_vectors = self.get_basis_vectors(
            i_hat_color=self.i_hat_color, j_hat_color=self.j_hat_color
        )
        self.moving_vectors += list(self.basis_vectors)
        self.i_hat, self.j_hat = self.basis_vectors
        self.add(self.basis_vectors)

add_background_mobject

Add mobjects that the transformations leave where they are, as they leave the background plane.

self.add_background_mobject(*mobjects)
Source

src/manimgx/scene.py

def add_background_mobject(self, *mobjects: Mobject) -> None:
    """Add mobjects that the transformations leave where they are, as they leave the
    background plane.
    """
    self.add_special_mobjects(self.background_mobjects, *mobjects)

add_foreground_mobject

Add mobjects that stay in front: drawn over everything else, and left where they are by the transformations.

self.add_foreground_mobject(*mobjects)
Source

src/manimgx/scene.py

def add_foreground_mobject(self, *mobjects: Mobject) -> Self:
    """Add mobjects that stay in front: drawn over everything else, and left where
    they are by the transformations.
    """
    self.add_special_mobjects(self.foreground_mobjects, *mobjects)
    return self

add_transformable_mobject

Add mobjects that the transformations move point by point, as they move the plane.

self.add_transformable_mobject(*mobjects)
Source

src/manimgx/scene.py

def add_transformable_mobject(self, *mobjects: Mobject) -> None:
    """Add mobjects that the transformations move point by point, as they move the
    plane.
    """
    self.add_special_mobjects(self.transformable_mobjects, *mobjects)

add_moving_mobject

Add a mobject that the transformations move whole, its shape unchanged: to where they take its center.

self.add_moving_mobject(mobject, target_mobject=None)
target_mobject

What it becomes as it moves, placed where the transformation takes its center; None for itself.

Source

src/manimgx/scene.py

def add_moving_mobject(
    self, mobject: Mobject, target_mobject: Mobject | None = None
) -> None:
    """Add a mobject that the transformations move whole, its shape unchanged: to
    where they take its center.

    Args:
        target_mobject: What it becomes as it moves, placed where the transformation
            takes its center; None for itself.
    """
    mobject.target = target_mobject
    self.add_special_mobjects(self.moving_mobjects, mobject)

get_ghost_vectors

The faded copies the transformations left of what they moved whole, where it was, with leave_ghost_vectors.

self.get_ghost_vectors()

Returns The group of them.

Source

src/manimgx/scene.py

def get_ghost_vectors(self) -> VGroup:
    """The faded copies the transformations left of what they moved whole, where it
    was, with `leave_ghost_vectors`.

    Returns:
        The group of them.
    """
    return self.ghost_vectors

get_unit_square

Make a rectangle over the plane's unit square: from its origin, one unit of x wide and one unit of y tall.

self.get_unit_square(color=PURE_YELLOW, opacity=0.3, stroke_width=3)
color

The color of its fill and its stroke.

opacity

Its fill's opacity, from 0 to 1.

stroke_width

Its stroke's width, in hundredths of a scene unit.

Returns A new rectangle, also kept as the scene's square.

Source

src/manimgx/scene.py

def get_unit_square(
    self, color: Colors = PURE_YELLOW, opacity: float = 0.3, stroke_width: float = 3
) -> Rectangle:
    """Make a rectangle over the plane's unit square: from its origin, one unit of x
    wide and one unit of y tall.

    Args:
        color: The color of its fill and its stroke.
        opacity: Its fill's opacity, from 0 to 1.
        stroke_width: Its stroke's width, in hundredths of a scene unit.

    Returns:
        A new rectangle, also kept as the scene's `square`.
    """
    square = self.square = Rectangle(
        color=color,
        width=self.plane.get_x_unit_size(),
        height=self.plane.get_y_unit_size(),
        stroke_color=color,
        stroke_width=stroke_width,
        fill_color=color,
        fill_opacity=opacity,
    )
    square.move_to(self.plane.coords_to_point(0, 0), DL)
    return square

add_unit_square

Add the plane's unit square, which the transformations move with the plane: its area shows how they scale areas.

The moving vectors are then brought to the front, over it.

self.add_unit_square(animate=False, **kwargs)
animate

Whether to draw it in: its border, then its fill.

color

The color of its fill and its stroke (default yellow).

opacity

Its fill's opacity, from 0 to 1 (default 0.3).

stroke_width

Its stroke's width, in hundredths of a scene unit (default 3).

Source

src/manimgx/scene.py

def add_unit_square(
    self, animate: bool = False, **kwargs: Unpack[UnitSquareOptions]
) -> Self:
    """Add the plane's unit square, which the transformations move with the plane:
    its area shows how they scale areas.

    The moving vectors are then brought to the front, over it.

    Args:
        animate: Whether to draw it in: its border, then its fill.
        **kwargs: [Unit square keywords][manimgx.scene.UnitSquareOptions].
    """
    square = self.get_unit_square(**kwargs)
    if animate:
        self.play(
            DrawBorderThenFill(square), Animation(Group(*self.moving_vectors))
        )
    self.add_transformable_mobject(square)
    self.bring_to_front(*self.moving_vectors)
    self.square = square
    return self

write_vector_coordinates

Write a vector's coordinates beside its tip, as a column that stays in front, where it is, through the transformations.

self.write_vector_coordinates(vector, **kwargs)

It also takes the Matrix keywords.

Returns The column.

Source

src/manimgx/scene.py

def write_vector_coordinates(
    self, vector: Vector, **kwargs: Unpack[MatrixOptions]
) -> Matrix:
    """Write a vector's coordinates beside its tip, as a column that stays in front,
    where it is, through the transformations.

    Args:
        **kwargs: [Matrix keywords][manimgx.mobjects.grid.MatrixOptions] for the
            column.

    Returns:
        The column.
    """
    coords = super().write_vector_coordinates(vector, **kwargs)
    self.add_foreground_mobject(coords)
    return coords

add_transformable_label

Label a vector with a label that the transformations carry along and rewrite.

After a transformation, the label sits by the vector where it went, and reads new_label, or else the label in the transformation's name: L(v) for a label v.

self.add_transformable_label(vector, label, transformation_name='L', new_label=None, *, animate=True, **kwargs)
vector

The vector, from the origin.

label

The label: a mobject, or LaTeX (see get_vector_label).

transformation_name

The name of the transformation.

new_label

What the label reads after a transformation; None for the transformation's name around it.

animate

Whether to write it in.

color

The label's color, when it is made from a string (default None: the vector's).

label_scale_factor

How much the label is scaled (default 0.8).

at_tip

Whether the label goes beyond the vector's tip, rather than beside its middle (default False).

direction

Which side of the vector the label goes on, looking along the vector (default "left").

rotate

Whether the label turns with the vector, rather than staying upright (default False).

Returns The label.

Source

src/manimgx/scene.py

def add_transformable_label(
    self,
    vector: Vector,
    label: ManimTextLabel | str,
    transformation_name: str | ManimTextLabel = "L",
    new_label: str | ManimTextLabel | None = None,
    *,
    animate: bool = True,
    **kwargs: Unpack[VectorLabelOptions],
) -> ManimTextLabel:
    """Label a vector with a label that the transformations carry along and rewrite.

    After a transformation, the label sits by the vector where it went, and reads
    `new_label`, or else the label in the transformation's name: `L(v)` for a label
    `v`.

    Args:
        vector: The vector, from the origin.
        label: The label: a mobject, or LaTeX (see
            [`get_vector_label`][manimgx.VectorScene.get_vector_label]).
        transformation_name: The name of the transformation.
        new_label: What the label reads after a transformation; None for the
            transformation's name around it.
        animate: Whether to write it in.
        **kwargs: [Vector label keywords][manimgx.scene.VectorLabelOptions].

    Returns:
        The label.
    """
    label_mob = self.label_vector(vector, label, animate, **kwargs)
    if new_label:
        target_text: str | ManimTextLabel = new_label
    else:
        written = (
            label_mob.tex_string
            if isinstance(label_mob, (MathTex, SingleStringMathTex))
            else str(label)
        )
        target_text = f"{transformation_name}({written})"
    self.transformable_labels.append(
        _TransformableLabel(label_mob, vector, target_text, kwargs)
    )
    return label_mob

add_title

Add a title at the top of the frame, in front and still, on a background rectangle.

self.add_title(title, scale_factor=1.5, animate=False)
title

The title: a mobject, or text, typeset as Tex.

scale_factor

How much text is scaled.

animate

Whether to write it in.

Source

src/manimgx/scene.py

def add_title(
    self, title: str | Mobject, scale_factor: float = 1.5, animate: bool = False
) -> Self:
    """Add a title at the top of the frame, in front and still, on a background
    rectangle.

    Args:
        title: The title: a mobject, or text, typeset as [`Tex`][manimgx.Tex].
        scale_factor: How much text is scaled.
        animate: Whether to write it in.
    """
    if not isinstance(title, Mobject):
        title = Tex(title).scale(scale_factor)
    title.to_edge(UP)
    title.add_background_rectangle()
    if animate:
        self.play(Write(title))
    self.add_foreground_mobject(title)
    self.title = title
    return self

apply_matrix

Apply a matrix to the plane and to everything on it, in one play.

Everything the transformations move goes where the matrix takes it (see apply_function). Unless a path_arc is given, the points travel along arcs that turn through the mean of the angles the matrix turns î and ĵ through.

self.apply_matrix(matrix, **kwargs)
matrix

A 2 × 2 matrix, which acts on x and y, or a 3 × 3 one: its columns are where it takes î and ĵ.

run_time

How long the animation plays, in seconds (default 1).

lag_ratio

How the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).

rate_func

How the animation's progress runs with time: a function from [0, 1] to [0, 1] (default smooth; see rate functions).

reverse_rate_function

Whether to run the animation backward (default False).

name

A name for the animation.

remover

Whether the mobject leaves the scene when the animation finishes (default False).

suspend_mobject_updating

Whether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.

introducer

Whether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.

use_override

Whether a mobject whose class plays another animation in place of this one does so (default True).

It also takes the transform keywords.

Source

src/manimgx/scene.py

def apply_matrix(
    self, matrix: npt.ArrayLike, **kwargs: Unpack[TransformOptions]
) -> None:
    """Apply a matrix to the plane and to everything on it, in one play.

    Everything the transformations move goes where the matrix takes it (see
    [`apply_function`][manimgx.LinearTransformationScene.apply_function]). Unless a
    `path_arc` is given, the points travel along arcs that turn through the mean of
    the angles the matrix turns î and ĵ through.

    Args:
        matrix: A 2 × 2 matrix, which acts on x and y, or a 3 × 3 one: its columns
            are where it takes î and ĵ.
        **kwargs: [Transform options][manimgx.animation.transform.TransformOptions] for
            every animation of the play (3 seconds long unless given a `run_time`).
    """
    self.apply_transposed_matrix(np.array(matrix).T, **kwargs)

apply_inverse

Apply the inverse of a matrix to the plane and to everything on it: undo apply_matrix of the same matrix.

self.apply_inverse(matrix, **kwargs)
matrix

The matrix, 2 × 2 or 3 × 3, which must be invertible.

run_time

How long the animation plays, in seconds (default 1).

lag_ratio

How the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).

rate_func

How the animation's progress runs with time: a function from [0, 1] to [0, 1] (default smooth; see rate functions).

reverse_rate_function

Whether to run the animation backward (default False).

name

A name for the animation.

remover

Whether the mobject leaves the scene when the animation finishes (default False).

suspend_mobject_updating

Whether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.

introducer

Whether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.

use_override

Whether a mobject whose class plays another animation in place of this one does so (default True).

It also takes the transform keywords.

Source

src/manimgx/scene.py

def apply_inverse(
    self, matrix: npt.ArrayLike, **kwargs: Unpack[TransformOptions]
) -> None:
    """Apply the inverse of a matrix to the plane and to everything on it: undo
    [`apply_matrix`][manimgx.LinearTransformationScene.apply_matrix] of the same
    matrix.

    Args:
        matrix: The matrix, 2 × 2 or 3 × 3, which must be invertible.
        **kwargs: [Transform options][manimgx.animation.transform.TransformOptions] for
            every animation of the play.
    """
    self.apply_matrix(np.linalg.inv(np.asarray(matrix, dtype=float)), **kwargs)

apply_transposed_matrix

Apply a matrix, given by its transpose, to the plane and to everything on it: as apply_matrix does.

self.apply_transposed_matrix(transposed_matrix, **kwargs)
transposed_matrix

The matrix's transpose, whose rows are where the matrix takes î and ĵ.

run_time

How long the animation plays, in seconds (default 1).

lag_ratio

How the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).

rate_func

How the animation's progress runs with time: a function from [0, 1] to [0, 1] (default smooth; see rate functions).

reverse_rate_function

Whether to run the animation backward (default False).

name

A name for the animation.

remover

Whether the mobject leaves the scene when the animation finishes (default False).

suspend_mobject_updating

Whether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.

introducer

Whether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.

use_override

Whether a mobject whose class plays another animation in place of this one does so (default True).

It also takes the transform keywords.

Source

src/manimgx/scene.py

def apply_transposed_matrix(
    self, transposed_matrix: npt.ArrayLike, **kwargs: Unpack[TransformOptions]
) -> None:
    """Apply a matrix, given by its transpose, to the plane and to everything on it:
    as [`apply_matrix`][manimgx.LinearTransformationScene.apply_matrix] does.

    Args:
        transposed_matrix: The matrix's transpose, whose rows are where the matrix
            takes î and ĵ.
        **kwargs: [Transform options][manimgx.animation.transform.TransformOptions] for
            every animation of the play.
    """
    func = self.get_transposed_matrix_transformation(transposed_matrix)
    if "path_arc" not in kwargs:
        kwargs["path_arc"] = float(
            np.mean(
                [
                    angle_of_vector(func(RIGHT)),
                    angle_of_vector(func(UP)) - np.pi / 2,
                ]
            )
        )
    self.apply_function(func, **kwargs)

apply_inverse_transpose

Apply the inverse of a matrix's transpose to the plane and to everything on it.

self.apply_inverse_transpose(t_matrix, **kwargs)
t_matrix

The matrix, 2 × 2 or 3 × 3, which must be invertible.

run_time

How long the animation plays, in seconds (default 1).

lag_ratio

How the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).

rate_func

How the animation's progress runs with time: a function from [0, 1] to [0, 1] (default smooth; see rate functions).

reverse_rate_function

Whether to run the animation backward (default False).

name

A name for the animation.

remover

Whether the mobject leaves the scene when the animation finishes (default False).

suspend_mobject_updating

Whether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.

introducer

Whether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.

use_override

Whether a mobject whose class plays another animation in place of this one does so (default True).

It also takes the transform keywords.

Source

src/manimgx/scene.py

def apply_inverse_transpose(
    self, t_matrix: npt.ArrayLike, **kwargs: Unpack[TransformOptions]
) -> None:
    """Apply the inverse of a matrix's transpose to the plane and to everything on
    it.

    Args:
        t_matrix: The matrix, 2 × 2 or 3 × 3, which must be invertible.
        **kwargs: [Transform options][manimgx.animation.transform.TransformOptions] for
            every animation of the play.
    """
    t_inv = np.linalg.inv(np.array(t_matrix, dtype=float).T).T
    self.apply_transposed_matrix(t_inv, **kwargs)

apply_nonlinear_transformation

Apply a function that need not be linear to the plane and to everything on it.

The plane's lines are first divided into many curves, so that they can bend (see apply_function).

self.apply_nonlinear_transformation(function, **kwargs)
function

The function, from a point to its image, in scene coordinates.

run_time

How long the animation plays, in seconds (default 1).

lag_ratio

How the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).

rate_func

How the animation's progress runs with time: a function from [0, 1] to [0, 1] (default smooth; see rate functions).

reverse_rate_function

Whether to run the animation backward (default False).

name

A name for the animation.

remover

Whether the mobject leaves the scene when the animation finishes (default False).

suspend_mobject_updating

Whether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.

introducer

Whether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.

use_override

Whether a mobject whose class plays another animation in place of this one does so (default True).

It also takes the transform keywords.

Source

src/manimgx/scene.py

def apply_nonlinear_transformation(
    self,
    function: Callable[[np.ndarray], np.ndarray],
    **kwargs: Unpack[TransformOptions],
) -> None:
    """Apply a function that need not be linear to the plane and to everything on
    it.

    The plane's lines are first divided into many curves, so that they can bend (see
    [`apply_function`][manimgx.LinearTransformationScene.apply_function]).

    Args:
        function: The function, from a point to its image, in scene coordinates.
        **kwargs: [Transform options][manimgx.animation.transform.TransformOptions] for
            every animation of the play.
    """
    self.plane.prepare_for_nonlinear_transform()
    self.apply_function(function, **kwargs)

apply_function

Apply a function to the plane and to everything on it, in one play.

Every point of the transformable mobjects goes where function takes it; each vector is redrawn to where its tip goes, and its transformable label follows it; each moving mobject moves whole to where its center goes; the foreground mobjects stay where they are. With leave_ghost_vectors, faded copies of what moves whole are left behind.

self.apply_function(function, added_anims=None, **kwargs)
function

The function, from a point to its image, in scene coordinates.

added_anims

Animations to play along.

run_time

How long the animation plays, in seconds (default 1).

lag_ratio

How the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).

rate_func

How the animation's progress runs with time: a function from [0, 1] to [0, 1] (default smooth; see rate functions).

reverse_rate_function

Whether to run the animation backward (default False).

name

A name for the animation.

remover

Whether the mobject leaves the scene when the animation finishes (default False).

suspend_mobject_updating

Whether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.

introducer

Whether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.

use_override

Whether a mobject whose class plays another animation in place of this one does so (default True).

It also takes the transform keywords.

Source

src/manimgx/scene.py

def apply_function(
    self,
    function: MappingFunction,
    added_anims: Sequence[Animation] | None = None,
    **kwargs: Unpack[TransformOptions],
) -> None:
    """Apply a function to the plane and to everything on it, in one play.

    Every point of the transformable mobjects goes where `function` takes it; each
    vector is redrawn to where its tip goes, and its transformable label follows it;
    each moving mobject moves whole to where its center goes; the foreground
    mobjects stay where they are. With `leave_ghost_vectors`, faded copies of what
    moves whole are left behind.

    Args:
        function: The function, from a point to its image, in scene coordinates.
        added_anims: Animations to play along.
        **kwargs: [Transform options][manimgx.animation.transform.TransformOptions] for
            every animation of the play (3 seconds long unless given a `run_time`).
    """
    kwargs.setdefault("run_time", 3)
    anims: list[Animation] = [
        *(
            ApplyPointwiseFunction(function, t_mob)
            for t_mob in self.transformable_mobjects
        ),
        self.get_vector_movement(function),
        self.get_transformable_label_movement(),
        self.get_moving_mobject_movement(function),
        *(Animation(f_mob) for f_mob in self.foreground_mobjects),
        *(added_anims or ()),
    ]
    self.play(*anims, **kwargs)

ZoomedScene

Code
import manimgx as m


class ZoomedSceneExample(m.ZoomedScene):
    def construct(self) -> None:
        title = m.Text("manimgx", font_size=120).shift(m.LEFT)
        note = m.Text("exact in time, typed throughout", font_size=14)
        note.next_to(title, m.DOWN)
        self.add(title, note)
        frame = self.zoomed_camera.frame
        frame.move_to(note.get_left())
        self.activate_zooming(animate=True)
        self.play(frame.animate.move_to(note.get_right()), run_time=2)

A scene with a second camera, whose picture is shown in the frame: a magnifying glass.

zoomed_camera sees what its frame, a small rectangle in the scene (zoomed_camera.frame), covers, and zoomed_display shows its picture, larger, in a corner of the frame. Both appear with activate_zooming; move, scale or animate the zoomed camera's frame to look elsewhere, and the picture follows.

class MyScene(m.ZoomedScene):
zoomed_display_height

The display's height, in scene units.

zoomed_display_width

The display's width, in scene units.

zoomed_display_center

Where the display's center is; None for a corner of the frame.

zoomed_display_corner

Which corner of the frame the display is in, when it has no zoomed_display_center: a direction, such as UR.

zoomed_display_corner_buff

The display's distance from the edges at that corner, in scene units.

zoomed_camera_config

The zoomed camera's look: its frame's outline, and its picture's background.

zoomed_camera_image_mobject_config

Keywords for the display, the picture of what the zoomed camera sees: its style, and its outline's (default_display_frame_config).

zoomed_camera_frame_starting_position

Where the zoomed camera's frame starts.

zoom_factor

The size of the zoomed camera's frame, as a fraction of the display's: the display magnifies 1 / zoom_factor times.

image_frame_stroke_width

Accepted for Manim compatibility; ignored.

zoom_activated

Whether zooming is active: activate_zooming sets it, and it shows nothing by itself.

Source

src/manimgx/scene.py

def __init__(
    self,
    zoomed_display_height: float = 3,
    zoomed_display_width: float = 3,
    zoomed_display_center: Point3DLike | None = None,
    zoomed_display_corner: Vector3DLike = UR,
    zoomed_display_corner_buff: float = DEFAULT_MOBJECT_TO_EDGE_BUFFER,
    zoomed_camera_config: ZoomedCameraConfig | None = None,
    zoomed_camera_image_mobject_config: ImageCameraOptions | None = None,
    zoomed_camera_frame_starting_position: Point3DLike = ORIGIN,
    zoom_factor: float = 0.15,
    image_frame_stroke_width: float = 3,
    zoom_activated: bool = False,
) -> None:
    self.zoomed_display_height = zoomed_display_height
    self.zoomed_display_width = zoomed_display_width
    self.zoomed_display_center = zoomed_display_center
    self.zoomed_display_corner = zoomed_display_corner
    self.zoomed_display_corner_buff = zoomed_display_corner_buff
    self.zoomed_camera_config = ZoomedCameraConfig(
        default_frame_stroke_width=2, background_opacity=1
    ) | (zoomed_camera_config or ZoomedCameraConfig())
    self.zoomed_camera_image_mobject_config: ImageCameraOptions = (
        zoomed_camera_image_mobject_config or {}
    )
    self.zoomed_camera_frame_starting_position = (
        zoomed_camera_frame_starting_position
    )
    self.zoom_factor = zoom_factor
    self.image_frame_stroke_width = (
        image_frame_stroke_width  # CE stores it and never reads it
    )
    self.zoom_activated = zoom_activated
    super().__init__()

setup

Make the zoomed camera and its display: render calls it before construct. A subclass that overrides it calls this one first.

self.setup()
Source

src/manimgx/scene.py

def setup(self) -> None:
    """Make the zoomed camera and its display: [`render`][manimgx.Scene.render]
    calls it before `construct`. A subclass that overrides it calls this one first.
    """
    from manimgx.mobjects.images import ImageMobjectFromCamera

    super().setup()
    options = self.zoomed_camera_config
    camera = Camera()
    camera.background_opacity = options.get("background_opacity", 1)
    camera.frame.set_stroke(
        options.get("default_frame_stroke_color", WHITE),
        options.get("default_frame_stroke_width", 2),
    )
    display = ImageMobjectFromCamera(
        camera, **self.zoomed_camera_image_mobject_config
    ).add_display_frame()
    for mob in (camera.frame, display):
        mob.stretch_to_fit_height(self.zoomed_display_height)
        mob.stretch_to_fit_width(self.zoomed_display_width)
    camera.frame.scale(self.zoom_factor)
    camera.frame.move_to(self.zoomed_camera_frame_starting_position)
    if self.zoomed_display_center is not None:
        display.move_to(self.zoomed_display_center)
    else:
        display.to_corner(
            self.zoomed_display_corner, buff=self.zoomed_display_corner_buff
        )
    self.zoomed_camera = camera
    self.zoomed_display = display

activate_zooming

Show the zoomed camera's frame and its display, in front of everything else.

self.activate_zooming(animate=False)
animate

Whether to animate their coming first, in two plays: the frame shrinks from the whole view to its place (get_zoom_in_animation), then the display grows out of it to its own (get_zoomed_display_pop_out_animation).

Source

src/manimgx/scene.py

def activate_zooming(self, animate: bool = False) -> None:
    """Show the zoomed camera's frame and its display, in front of everything else.

    Args:
        animate: Whether to animate their coming first, in two plays: the frame
            shrinks from the whole view to its place (`get_zoom_in_animation`), then
            the display grows out of it to its own
            (`get_zoomed_display_pop_out_animation`).
    """
    self.zoom_activated = True
    if animate:
        self.play(self.get_zoom_in_animation())
        self.play(self.get_zoomed_display_pop_out_animation())
    self.add_foreground_mobjects(self.zoomed_camera.frame, self.zoomed_display)

get_zoom_in_animation

Make the animation in which the zoomed camera's frame shrinks from the whole view to its place.

The frame moves to its start at once: it covers the view, centered on the origin, without its outline, until the animation plays.

self.get_zoom_in_animation(**kwargs)
run_time

How long the animation plays, in seconds (default 1).

lag_ratio

How the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).

rate_func

How the animation's progress runs with time: a function from [0, 1] to [0, 1] (default smooth; see rate functions).

reverse_rate_function

Whether to run the animation backward (default False).

name

A name for the animation.

remover

Whether the mobject leaves the scene when the animation finishes (default False).

suspend_mobject_updating

Whether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.

introducer

Whether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.

use_override

Whether a mobject whose class plays another animation in place of this one does so (default True).

It also takes the transform keywords.

Returns The animation, to play.

Source

src/manimgx/scene.py

def get_zoom_in_animation(self, **kwargs: Unpack[TransformOptions]) -> Animation:
    """Make the animation in which the zoomed camera's frame shrinks from the whole
    view to its place.

    The frame moves to its start at once: it covers the view, centered on the
    origin, without its outline, until the animation plays.

    Args:
        **kwargs: [Transform options][manimgx.animation.transform.TransformOptions] (2
            seconds long unless given a `run_time`).

    Returns:
        The animation, to play.
    """
    from manimgx.animation.motion import Restore

    kwargs.setdefault("run_time", 2)
    frame = self.zoomed_camera.frame
    frame.save_state()
    frame.stretch_to_fit_width(self.camera.frame_width)
    frame.stretch_to_fit_height(self.camera.frame_height)
    frame.center()
    frame.set_stroke(width=0)
    return Restore(frame, **kwargs)

get_zoomed_display_pop_out_animation

Make the animation in which the display grows out of the zoomed camera's frame to its place.

The display moves to its start at once: over the zoomed camera's frame, until the animation plays.

self.get_zoomed_display_pop_out_animation(**kwargs)
run_time

How long the animation plays, in seconds (default 1).

lag_ratio

How the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).

rate_func

How the animation's progress runs with time: a function from [0, 1] to [0, 1] (default smooth; see rate functions).

reverse_rate_function

Whether to run the animation backward (default False).

name

A name for the animation.

remover

Whether the mobject leaves the scene when the animation finishes (default False).

suspend_mobject_updating

Whether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.

introducer

Whether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.

use_override

Whether a mobject whose class plays another animation in place of this one does so (default True).

It also takes the transform keywords.

Returns The animation, to play.

Source

src/manimgx/scene.py

def get_zoomed_display_pop_out_animation(
    self, **kwargs: Unpack[TransformOptions]
) -> Animation:
    """Make the animation in which the display grows out of the zoomed camera's
    frame to its place.

    The display moves to its start at once: over the zoomed camera's frame, until
    the animation plays.

    Args:
        **kwargs: [Transform options][manimgx.animation.transform.TransformOptions].

    Returns:
        The animation, to play.
    """
    from manimgx.animation.motion import Restore

    display = self.zoomed_display
    display.save_state()
    display.replace(self.zoomed_camera.frame, stretch=True)
    return Restore(display, **kwargs)

get_zoom_factor

How small the zoomed camera's frame is next to the display.

self.get_zoom_factor()

Returns the display magnifies its inverse.

Source

src/manimgx/scene.py

def get_zoom_factor(self) -> float:
    """How small the zoomed camera's frame is next to the display.

    Returns:
        The frame's height over the display's: the display magnifies its inverse.
    """
    return self.zoomed_camera.frame.height / self.zoomed_display.height

ZoomedCameraConfig

The zoomed camera's look: its frame's stroke and its picture's background.

default_frame_stroke_width

The width of the zoomed camera frame's outline, in hundredths of a scene unit (default 2).

default_frame_stroke_color

The color of the zoomed camera frame's outline (default white).

background_opacity

The opacity of the zoomed picture's background, from 0 to 1 (default 1: it hides what is behind the display).

default_frame_stroke_width

The width of the zoomed camera frame's outline, in hundredths of a scene unit (default 2).

default_frame_stroke_color

The color of the zoomed camera frame's outline (default white).

background_opacity

The opacity of the zoomed picture's background, from 0 to 1 (default 1: it hides what is behind the display).