API 参考:摄像机(camera)

共 8 个类,按字母排序。每个类含中文说明、继承链、参数表与上手示例,API 文档由 autodoc 从 manim v0.21.0 源码自动生成;带完整中文精讲的类见 API 索引。

BackgroundColoredVMobjectDisplayer

把 VMobject 按背景色反色显示的辅助相机组件,内部机制居多。

参数

API 文档

class manim.BackgroundColoredVMobjectDisplayer(camera: Camera)

基类:object

display(*cvmobjects: VMobject) → PixelArray | None

Displays the colored VMobjects.

Parameters

*cvmobjects

The VMobjects

Returns

np.array

The pixel array with the cvmobjects displayed.

get_background_array(image: Image.Image | pathlib.Path | str) → PixelArray

Gets the background array that has the passed file_name.

Parameters

image

The background image or its file name.

Returns

np.ndarray

The pixel array of the image.

resize_background_array(background_array: PixelArray, new_width: float, new_height: float, mode: str = 'RGBA') → PixelArray

Resizes the pixel array representing the background.

Parameters

background_array

The pixel

new_width

The new width of the background

new_height

The new height of the background

mode

The PIL image mode, by default "RGBA"

Returns

np.array

The numpy pixel array of the resized background.

resize_background_array_to_match(background_array: PixelArray, pixel_array: PixelArray) → PixelArray

Resizes the background array to match the passed pixel array.

Parameters

background_array

The prospective pixel array.

pixel_array

The pixel array whose width and height should be matched.

Returns

np.array

The resized background array.

Camera

相机基类:管理画面帧、像素坐标与 Mobject 的投影,所有渲染都从它开始。

参数

background_image

None,str | None

frame_center

array([0., 0., 0.]),Point3D

image_mode

'RGBA',str

n_channels

4,int

pixel_array_dtype

'uint8',str

cairo_line_width_multiple

0.01,float

use_z_index

True,bool

background

None,PixelArray | None

pixel_height

None,int | None

pixel_width

None,int | None

frame_height

None,float | None

frame_width

None,float | None

frame_rate

None,float | None

background_color

None

background_opacity

None,float | None

快速上手

self.camera.frame.set(width=10)

API 文档

class manim.Camera(background_image: str | None = None, frame_center: Point3D = array([0., 0., 0.]), image_mode: str = 'RGBA', n_channels: int = 4, pixel_array_dtype: str = 'uint8', cairo_line_width_multiple: float = 0.01, use_z_index: bool = True, background: PixelArray | None = None, pixel_height: int | None = None, pixel_width: int | None = None, frame_height: float | None = None, frame_width: float | None = None, frame_rate: float | None = None, background_color: ParsableManimColor | None = None, background_opacity: float | None = None, **kwargs: Any)

基类:object

adjust_out_of_range_points(points: ndarray) → ndarray

If any of the points in the passed array are out of the viable range, they are adjusted suitably.

Parameters

points

The points to adjust

Returns

np.array

The adjusted points.

adjusted_thickness(thickness: float) → float

Computes the adjusted stroke width for a zoomed camera.

Parameters

thickness

The stroke width of a mobject.

Returns

float

The adjusted stroke width that reflects zooming in with the camera.

apply_fill(ctx: Context, vmobject: VMobject) → Self

Fills the cairo context

Parameters

ctx

The cairo context

vmobject

The VMobject

Returns

Camera

The camera object.

apply_stroke(ctx: Context, vmobject: VMobject, background: bool = False) → Self

Applies a stroke to the VMobject in the cairo context.

Parameters

ctx

The cairo context

vmobject

The VMobject

background

Whether or not to consider the background when applying this stroke width, by default False

Returns

Camera

The camera object with the stroke applied.

cache_cairo_context(pixel_array: PixelArray, ctx: cairo.Context) → None

Caches the passed Pixel array into a Cairo Context

Parameters

pixel_array

The pixel array to cache

ctx

The context to cache it into.

capture_mobject(mobject: Mobject, **kwargs: Any) → None

Capture mobjects by storing it in pixel_array.

This is a single-mobject version of capture_mobjects().

Parameters

mobject

Mobject to capture.

kwargs

Keyword arguments to be passed to get_mobjects_to_display().

capture_mobjects(mobjects: Iterable[Mobject], **kwargs: Any) → None

Capture mobjects by printing them on pixel_array.

This is the essential function that converts the contents of a Scene into an array, which is then converted to an image or video.

Parameters

mobjects

Mobjects to capture.

kwargs

Keyword arguments to be passed to get_mobjects_to_display().

Notes

For a list of classes that can currently be rendered, see display_funcs().

convert_pixel_array(pixel_array: PixelArray | list | tuple) → PixelArray

Converts a pixel array with float values to proper RGB values.

Parameters

pixel_array

Pixel array to convert.

Returns

np.array

The new, converted pixel array.

display_image_mobject(image_mobject: AbstractImageMobject, pixel_array: np.ndarray) → None

Display an ImageMobject by changing the pixel_array suitably.

Parameters

image_mobject

The ImageMobject to display.

pixel_array

The pixel array to put the ImageMobject in.

display_multiple_background_colored_vmobjects(cvmobjects: Iterable[VMobject], pixel_array: PixelArray) → Self

Displays multiple vmobjects that have the same color as the background.

Parameters

cvmobjects

List of Colored VMobjects

pixel_array

The pixel array.

Returns

Camera

The camera object.

display_multiple_image_mobjects(image_mobjects: Iterable[AbstractImageMobject], pixel_array: PixelArray) → None

Displays multiple image mobjects by modifying the passed pixel_array.

Parameters

image_mobjects

list of ImageMobjects

pixel_array

The pixel array to modify.

display_multiple_non_background_colored_vmobjects(vmobjects: Iterable[VMobject], pixel_array: PixelArray) → None

Displays multiple VMobjects in the cairo context, as long as they don't have background colors.

Parameters

vmobjects

list of the VMobjects

pixel_array

The Pixel array to add the VMobjects to.

display_multiple_point_cloud_mobjects(pmobjects: Iterable[PMobject], pixel_array: PixelArray) → None

Displays multiple PMobjects by modifying the passed pixel array.

Parameters

pmobjects

List of PMobjects

pixel_array

The pixel array to modify.

display_multiple_vectorized_mobjects(vmobjects: list[VMobject], pixel_array: PixelArray) → None

Displays multiple VMobjects in the pixel_array

Parameters

vmobjects

list of VMobjects to display

pixel_array

The pixel array

display_point_cloud(pmobject: PMobject, points: Point3D_Array, rgbas: FloatRGBA_Array, thickness: float, pixel_array: PixelArray) → None

Displays a PMobject by modifying the pixel array suitably.

TODO: Write a description for the rgbas argument.

Parameters

pmobject

Point Cloud Mobject

points

The points to display in the point cloud mobject

rgbas

thickness

The thickness of each point of the PMobject

pixel_array

The pixel array to modify.

display_vectorized(vmobject: VMobject, ctx: Context) → Self

Displays a VMobject in the cairo context

Parameters

vmobject

The Vectorized Mobject to display

ctx

The cairo context to use.

Returns

Camera

The camera object

get_background_colored_vmobject_displayer() → BackgroundColoredVMobjectDisplayer

Returns the background_colored_vmobject_displayer if it exists or makes one and returns it if not.

Returns

BackgroundColoredVMobjectDisplayer

Object that displays VMobjects that have the same color as the background.

get_cached_cairo_context(pixel_array: PixelArray) → cairo.Context | None

Returns the cached cairo context of the passed pixel array if it exists, and None if it doesn't.

Parameters

pixel_array

The pixel array to check.

Returns

cairo.Context

The cached cairo context.

get_cairo_context(pixel_array: PixelArray) → cairo.Context

Returns the cairo context for a pixel array after caching it to self.pixel_array_to_cairo_context If that array has already been cached, it returns the cached version instead.

Parameters

pixel_array

The Pixel array to get the cairo context of.

Returns

cairo.Context

The cairo context of the pixel array.

get_coords_of_all_pixels() → PixelArray

Returns the cartesian coordinates of each pixel.

Returns

np.ndarray

The array of cartesian coordinates.

get_fill_rgbas(vmobject: VMobject) → FloatRGBA_Array

Returns the RGBA array of the fill of the passed VMobject

Parameters

vmobject

The VMobject

Returns

np.array

The RGBA Array of the fill of the VMobject

get_image(pixel_array: PixelArray | list | tuple | None = None) → Image.Image

Returns an image from the passed pixel array, or from the current frame if the passed pixel array is none.

Parameters

pixel_array

The pixel array from which to get an image, by default None

Returns

PIL.Image.Image

The PIL image of the array.

get_mobjects_to_display(mobjects: Iterable[Mobject], include_submobjects: bool = True, excluded_mobjects: list | None = None) → list[Mobject]

Used to get the list of mobjects to display with the camera.

Parameters

mobjects

The Mobjects

include_submobjects

Whether or not to include the submobjects of mobjects, by default True

excluded_mobjects

Any mobjects to exclude, by default None

Returns

list

list of mobjects

get_stroke_rgbas(vmobject: VMobject, background: bool = False) → FloatRGBA_Array

Gets the RGBA array for the stroke of the passed VMobject.

Parameters

vmobject

The VMobject

background

Whether or not to consider the background when getting the stroke RGBAs, by default False

Returns

np.ndarray

The RGBA array of the stroke.

get_thickening_nudges(thickness: float) → PixelArray

Determine a list of vectors used to nudge two-dimensional pixel coordinates.

Parameters

thickness

Returns

np.array

init_background() → None

Initialize the background. If self.background_image is the path of an image the image is set as background; else, the default background color fills the background.

is_in_frame(mobject: Mobject) → bool

Checks whether the passed mobject is in frame or not.

Parameters

mobject

The mobject for which the checking needs to be done.

Returns

bool

True if in frame, False otherwise.

make_background_from_func(coords_to_colors_func: Callable[[np.ndarray], np.ndarray]) → PixelArray

Makes a pixel array for the background by using coords_to_colors_func to determine each pixel's color. Each input pixel's color. Each input to coords_to_colors_func is an (x, y) pair in space (in ordinary space coordinates; not pixel coordinates), and each output is expected to be an RGBA array of 4 floats.

Parameters

coords_to_colors_func

The function whose input is an (x,y) pair of coordinates and whose return values must be the colors for that point

Returns

np.array

The pixel array which can then be passed to set_background.

on_screen_pixels(pixel_coords: np.ndarray) → PixelArray

Returns array of pixels that are on the screen from a given array of pixel_coordinates

Parameters

pixel_coords

The pixel coords to check.

Returns

np.array

The pixel coords on screen.

overlay_PIL_image(pixel_array: ndarray, image: <module 'PIL.Image' from '/opt/hostedtoolcache/Python/3.12.15/x64/lib/python3.12/site-packages/PIL/Image.py'>) → None

Overlays a PIL image on the passed pixel array.

Parameters

pixel_array

The Pixel array

image

The Image to overlay.

overlay_rgba_array(pixel_array: ndarray, new_array: ndarray) → None

Overlays an RGBA array on top of the given Pixel array.

Parameters

pixel_array

The original pixel array to modify.

new_array

The new pixel array to overlay.

reset() → Self

Resets the camera's pixel array to that of the background

Returns

Camera

The camera object after setting the pixel array.

reset_pixel_shape(new_height: float, new_width: float) → None

This method resets the height and width of a single pixel to the passed new_height and new_width.

Parameters

new_height

The new height of the entire scene in pixels

new_width

The new width of the entire scene in pixels

resize_frame_shape(fixed_dimension: int = 0) → None

Changes frame_shape to match the aspect ratio of the pixels, where fixed_dimension determines whether frame_height or frame_width remains fixed while the other changes accordingly.

Parameters

fixed_dimension

If 0, height is scaled with respect to width else, width is scaled with respect to height.

set_background(pixel_array: PixelArray | list | tuple, convert_from_floats: bool = False) → None

Sets the background to the passed pixel_array after converting to valid RGB values.

Parameters

pixel_array

The pixel array to set the background to.

convert_from_floats

Whether or not to convert floats values to proper RGB valid ones, by default False

set_background_from_func(coords_to_colors_func: Callable[[ndarray], ndarray]) → None

Sets the background to a pixel array using coords_to_colors_func to determine each pixel's color. Each input pixel's color. Each input to coords_to_colors_func is an (x, y) pair in space (in ordinary space coordinates; not pixel coordinates), and each output is expected to be an RGBA array of 4 floats.

Parameters

coords_to_colors_func

The function whose input is an (x,y) pair of coordinates and whose return values must be the colors for that point

set_cairo_context_color(ctx: cairo.Context, rgbas: FloatRGBALike_Array, vmobject: VMobject) → Self

Sets the color of the cairo context

Parameters

ctx

The cairo context

rgbas

The RGBA array with which to color the context.

vmobject

The VMobject with which to set the color.

Returns

Camera

The camera object

set_cairo_context_path(ctx: Context, vmobject: VMobject) → Self

Sets a path for the cairo context with the vmobject passed

Parameters

ctx

The cairo context

vmobject

The VMobject

Returns

Camera

Camera object after setting cairo_context_path

set_pixel_array(pixel_array: PixelArray | list | tuple, convert_from_floats: bool = False) → None

Sets the pixel array of the camera to the passed pixel array.

Parameters

pixel_array

The pixel array to convert and then set as the camera's pixel array.

convert_from_floats

Whether or not to convert float values to proper RGB values, by default False

thickened_coordinates(pixel_coords: np.ndarray, thickness: float) → PixelArray

Returns thickened coordinates for a passed array of pixel coords and a thickness to thicken by.

Parameters

pixel_coords

Pixel coordinates

thickness

Thickness

Returns

np.array

Array of thickened pixel coords.

type_or_raise(mobject: Mobject) → type[VMobject] | type[PMobject] | type[AbstractImageMobject] | type[Mobject]

Return the type of mobject, if it is a type that can be rendered.

If mobject is an instance of a class that inherits from a class that can be rendered, return the super class. For example, an instance of a Square is also an instance of VMobject, and these can be rendered. Therefore, type_or_raise(Square()) returns True.

Parameters

mobject

The object to take the type of.

Notes

For a list of classes that can currently be rendered, see display_funcs().

Returns

Type[Mobject]

The type of mobjects, if it can be rendered.

Raises

TypeError

When mobject is not an instance of a class that can be rendered.

MappingCamera

映射相机:局部应用变换映射后拍摄,做放大镜视窗用。

继承关系

G Camera Camera MappingCamera MappingCamera Camera->MappingCamera

参数

mapping_func

<function MappingCamera.<la…

min_num_curves

50

allow_object_intrusion

False

API 文档

class manim.MappingCamera(mapping_func=<function MappingCamera.<lambda>>, min_num_curves=50, allow_object_intrusion=False, **kwargs)

基类:Camera

capture_mobjects(mobjects, **kwargs)

Capture mobjects for rendering after applying the spatial mapping.

Copies mobjects unless intrusion is allowed, and ensures vector objects have enough curves for smooth distortion.

MovingCamera

可移动相机:帧可随 updater 平移/缩放/旋转,是 MovingCameraScene 的底层。

继承关系

G Camera Camera MovingCamera MovingCamera Camera->MovingCamera

参数

frame

None,Mobject | None

fixed_dimension

0,int

default_frame_stroke_color

ManimColor('#FFFFFF'),ManimColor

default_frame_stroke_width

0,int

API 文档

class manim.MovingCamera(frame: Mobject | None = None, fixed_dimension: int = 0, default_frame_stroke_color: ManimColor = ManimColor('#FFFFFF'), default_frame_stroke_width: int = 0, **kwargs: Any)

基类:Camera

auto_zoom(mobjects: Iterable[Mobject], margin: float, only_mobjects_in_frame: bool, animate: Literal[False]) → Mobject
auto_zoom(mobjects: Iterable[Mobject], margin: float, only_mobjects_in_frame: bool, animate: Literal[True]) → _AnimationBuilder

Zooms on to a given array of mobjects (or a singular mobject) and automatically resizes to frame all the mobjects.

备注

This method only works when 2D-objects in the XY-plane are considered, it will not work correctly when the camera has been rotated.

Parameters

mobjects

The mobject or array of mobjects that the camera will focus on.

margin

The width of the margin that is added to the frame (optional, 0 by default).

only_mobjects_in_frame

If set to True, only allows focusing on mobjects that are already in frame.

animate

If set to False, applies the changes instead of returning the corresponding animation

Returns

Union[_AnimationBuilder, ScreenRectangle]

_AnimationBuilder that zooms the camera view to a given list of mobjects or ScreenRectangle with position and size updated to zoomed position.

cache_cairo_context(pixel_array: NDArray[int64], ctx: Context) → None

Since the frame can be moving around, the cairo context used for updating should be regenerated at each frame. So no caching.

capture_mobjects(mobjects: Iterable[Mobject], **kwargs: Any) → None

Capture mobjects by printing them on pixel_array.

This is the essential function that converts the contents of a Scene into an array, which is then converted to an image or video.

Parameters

mobjects

Mobjects to capture.

kwargs

Keyword arguments to be passed to get_mobjects_to_display().

Notes

For a list of classes that can currently be rendered, see display_funcs().

property frame_center: NDArray[float64]

Returns the centerpoint of the frame in cartesian coordinates.

Returns

np.array

The cartesian coordinates of the center of the frame.

property frame_height: float

Returns the height of the frame.

Returns

float

The height of the frame.

property frame_width: float

Returns the width of the frame

Returns

float

The width of the frame.

get_cached_cairo_context(pixel_array: NDArray[int64]) → None

Since the frame can be moving around, the cairo context used for updating should be regenerated at each frame. So no caching.

get_mobjects_indicating_movement() → list[Mobject]

Returns all mobjects whose movement implies that the camera should think of all other mobjects on the screen as moving

Returns

list[Mobject]

MultiCamera

多相机合成:把多个相机画面按子矩形拼到一个画面里。

继承关系

G Camera Camera MovingCamera MovingCamera Camera->MovingCamera MultiCamera MultiCamera MovingCamera->MultiCamera

参数

image_mobjects_from_cameras

None

allow_cameras_to_capture_their_own_display

False,bool

API 文档

class manim.MultiCamera(image_mobjects_from_cameras: Iterable[ImageMobjectFromCamera] | None = None, allow_cameras_to_capture_their_own_display: bool = False, **kwargs: Any)

基类:MovingCamera

add_image_mobject_from_camera(image_mobject_from_camera: ImageMobjectFromCamera) → None

Adds an ImageMobject that's been obtained from the camera into the list self.image_mobject_from_cameras

Parameters

image_mobject_from_camera

The ImageMobject to add to self.image_mobject_from_cameras

capture_mobjects(mobjects: Iterable[Mobject], **kwargs: Any) → None

Capture mobjects by printing them on pixel_array.

This is the essential function that converts the contents of a Scene into an array, which is then converted to an image or video.

Parameters

mobjects

Mobjects to capture.

kwargs

Keyword arguments to be passed to get_mobjects_to_display().

Notes

For a list of classes that can currently be rendered, see display_funcs().

get_mobjects_indicating_movement() → list[Mobject]

Returns all mobjects whose movement implies that the camera should think of all other mobjects on the screen as moving

Returns

list

reset() → Self

Resets the MultiCamera.

Returns

MultiCamera

The reset MultiCamera

update_sub_cameras() → None

Reshape sub_camera pixel_arrays

OldMultiCamera

旧版多相机实现,已被 MultiCamera 取代,仅作兼容保留。

继承关系

G Camera Camera OldMultiCamera OldMultiCamera Camera->OldMultiCamera

API 文档

class manim.OldMultiCamera(*cameras_with_start_positions, **kwargs)

基类:Camera

capture_mobjects(mobjects, **kwargs)

Capture mobjects by printing them on pixel_array.

This is the essential function that converts the contents of a Scene into an array, which is then converted to an image or video.

Parameters

mobjects

Mobjects to capture.

kwargs

Keyword arguments to be passed to get_mobjects_to_display().

Notes

For a list of classes that can currently be rendered, see display_funcs().

init_background()

Initialize the background. If self.background_image is the path of an image the image is set as background; else, the default background color fills the background.

set_background(pixel_array, **kwargs)

Sets the background to the passed pixel_array after converting to valid RGB values.

Parameters

pixel_array

The pixel array to set the background to.

convert_from_floats

Whether or not to convert floats values to proper RGB valid ones, by default False

set_pixel_array(pixel_array, **kwargs)

Sets the pixel array of the camera to the passed pixel array.

Parameters

pixel_array

The pixel array to convert and then set as the camera's pixel array.

convert_from_floats

Whether or not to convert float values to proper RGB values, by default False

SplitScreenCamera

分屏相机:左右分屏显示两个画面,对比演示可用。

继承关系

G Camera Camera OldMultiCamera OldMultiCamera Camera->OldMultiCamera SplitScreenCamera SplitScreenCamera OldMultiCamera->SplitScreenCamera

参数

left_camera

—

right_camera

—

API 文档

class manim.SplitScreenCamera(left_camera, right_camera, **kwargs)

基类:OldMultiCamera

ThreeDCamera

三维相机:管理 phi/theta/gamma 视角参数与三维投影,ThreeDScene 的渲染核心。

继承关系

G Camera Camera ThreeDCamera ThreeDCamera Camera->ThreeDCamera

参数

focal_distance

20.0,float

shading_factor

0.2,float

default_distance

5.0,float

light_source_start_point

array([-7., -9., 10.]),Point3DLike

should_apply_shading

True,bool

exponential_projection

False,bool

phi

0,float

theta

-1.5707963267948966,float

gamma

0,float

zoom

1,float

快速上手

self.set_camera_orientation(phi=70 * DEGREES, theta=30 * DEGREES)

API 文档

class manim.ThreeDCamera(focal_distance: float = 20.0, shading_factor: float = 0.2, default_distance: float = 5.0, light_source_start_point: NDArray[float64] | tuple[float, float, float] = array([-7., -9., 10.]), should_apply_shading: bool = True, exponential_projection: bool = False, phi: float = 0, theta: float = -1.5707963267948966, gamma: float = 0, zoom: float = 1, **kwargs: Any)

基类:Camera

add_fixed_in_frame_mobjects(*mobjects: Mobject) → None

This method allows the mobject to have a fixed position, even when the camera moves around. E.G If it was passed through this method, at the top of the frame, it will continue to be displayed at the top of the frame.

Highly useful when displaying Titles or formulae or the like.

Parameters

**mobjects

The mobject to fix in frame.

add_fixed_orientation_mobjects(*mobjects: Mobject, use_static_center_func: bool = False, center_func: Callable[[], NDArray[float64]] | None = None) → None

This method allows the mobject to have a fixed orientation, even when the camera moves around. E.G If it was passed through this method, facing the camera, it will continue to face the camera even as the camera moves. Highly useful when adding labels to graphs and the like.

Parameters

*mobjects

The mobject whose orientation must be fixed.

use_static_center_func

Whether or not to use the function that takes the mobject's center as centerpoint, by default False

center_func

The function which returns the centerpoint with respect to which the mobject will be oriented, by default None

capture_mobjects(mobjects: Iterable[Mobject], **kwargs: Any) → None

Capture mobjects by printing them on pixel_array.

This is the essential function that converts the contents of a Scene into an array, which is then converted to an image or video.

Parameters

mobjects

Mobjects to capture.

kwargs

Keyword arguments to be passed to get_mobjects_to_display().

Notes

For a list of classes that can currently be rendered, see display_funcs().

generate_rotation_matrix() → NDArray[float64]

Generates a rotation matrix based off the current position of the camera.

Returns

np.array

The matrix corresponding to the current position of the camera.

get_fill_rgbas(vmobject: VMobject) → NDArray[float64]

Returns the RGBA array of the fill of the passed VMobject

Parameters

vmobject

The VMobject

Returns

np.array

The RGBA Array of the fill of the VMobject

get_focal_distance() → float

Returns focal_distance of the Camera.

Returns

float

The focal_distance of the Camera in MUnits.

get_gamma() → float

Returns the rotation of the camera about the vector from the ORIGIN to the Camera.

Returns

float

The angle of rotation of the camera about the vector from the ORIGIN to the Camera in radians

get_mobjects_to_display(*args: Any, **kwargs: Any) → list[Mobject]

Used to get the list of mobjects to display with the camera.

Parameters

mobjects

The Mobjects

include_submobjects

Whether or not to include the submobjects of mobjects, by default True

excluded_mobjects

Any mobjects to exclude, by default None

Returns

list

list of mobjects

get_phi() → float

Returns the Polar angle (the angle off Z_AXIS) phi.

Returns

float

The Polar angle in radians.

get_rotation_matrix() → NDArray[float64]

Returns the matrix corresponding to the current position of the camera.

Returns

np.array

The matrix corresponding to the current position of the camera.

get_stroke_rgbas(vmobject: VMobject, background: bool = False) → NDArray[float64]

Gets the RGBA array for the stroke of the passed VMobject.

Parameters

vmobject

The VMobject

background

Whether or not to consider the background when getting the stroke RGBAs, by default False

Returns

np.ndarray

The RGBA array of the stroke.

get_theta() → float

Returns the Azimuthal i.e the angle that spins the camera around the Z_AXIS.

Returns

float

The Azimuthal angle in radians.

get_value_trackers() → list[ValueTracker]

A list of ValueTrackers of phi, theta, focal_distance, gamma and zoom.

Returns

list

list of ValueTracker objects

get_zoom() → float

Returns the zoom amount of the camera.

Returns

float

The zoom amount of the camera.

project_point(point: NDArray[float64]) → NDArray[float64]

Applies the current rotation_matrix as a projection matrix to the passed point.

Parameters

point

The point to project.

Returns

np.array

The point after projection.

project_points(points: NDArray[float64]) → NDArray[float64]

Applies the current rotation_matrix as a projection matrix to the passed array of points.

Parameters

points

The list of points to project.

Returns

np.array

The points after projecting.

remove_fixed_in_frame_mobjects(*mobjects: Mobject) → None

If a mobject was fixed in frame by passing it through add_fixed_in_frame_mobjects(), then this undoes that fixing. The Mobject will no longer be fixed in frame.

Parameters

mobjects

The mobjects which need not be fixed in frame any longer.

remove_fixed_orientation_mobjects(*mobjects: Mobject) → None

If a mobject was fixed in its orientation by passing it through add_fixed_orientation_mobjects(), then this undoes that fixing. The Mobject will no longer have a fixed orientation.

Parameters

mobjects

The mobjects whose orientation need not be fixed any longer.

reset_rotation_matrix() → None

Sets the value of self.rotation_matrix to the matrix corresponding to the current position of the camera

set_focal_distance(value: float) → None

Sets the focal_distance of the Camera.

Parameters

value

The focal_distance of the Camera.

set_gamma(value: float) → None

Sets the angle of rotation of the camera about the vector from the ORIGIN to the Camera.

Parameters

value

The new angle of rotation of the camera.

set_phi(value: float) → None

Sets the polar angle i.e the angle between Z_AXIS and Camera through ORIGIN in radians.

Parameters

value

The new value of the polar angle in radians.

set_theta(value: float) → None

Sets the azimuthal angle i.e the angle that spins the camera around Z_AXIS in radians.

Parameters

value

The new value of the azimuthal angle in radians.

set_zoom(value: float) → None

Sets the zoom amount of the camera.

Parameters

value

The zoom amount of the camera.