Skip to main content

Class: MappingCamera

Defined in: src/core/CameraExtensions.ts:1008

MappingCamera - A Camera2D that applies a coordinate mapping function to transform how the scene is viewed.

Based on Python Manim's MappingCamera concept. Use cases include non-linear coordinate distortions and custom projections.

Extends​

Constructors​

Constructor​

new MappingCamera(options): MappingCamera

Defined in: src/core/CameraExtensions.ts:1015

Create a new MappingCamera.

Parameters​

options​

MappingCameraOptions = {}

Camera configuration options

Returns​

MappingCamera

Overrides​

Camera2D.constructor

Accessors​

aspectMode​

Get Signature​

get aspectMode(): Camera2DAspectMode

Defined in: src/core/Camera.ts:345

Get the current aspect-mode (see Camera2DAspectMode).

Returns​

Camera2DAspectMode

Set Signature​

set aspectMode(mode): void

Defined in: src/core/Camera.ts:353

Set the aspect-mode. Re-applies the current aspect ratio so the projection updates immediately.

Parameters​
mode​

Camera2DAspectMode

Returns​

void

Inherited from​

Camera2D.aspectMode


frame​

Get Signature​

get frame(): Camera2DFrame

Defined in: src/core/Camera.ts:416

Lazy-created Camera2DFrame for Manim-style camera.frame API. The frame is a VMobject whose position and scale drive the camera, enabling animations like Restore, MoveToTarget, and updaters.

Returns​

Camera2DFrame

Inherited from​

Camera2D.frame


frameHeight​

Get Signature​

get frameHeight(): number

Defined in: src/core/Camera.ts:329

Get the frame height in world units.

Returns​

number

Set Signature​

set frameHeight(height): void

Defined in: src/core/Camera.ts:336

Set the frame height in world units.

Parameters​
height​

number

Returns​

void

Inherited from​

Camera2D.frameHeight


frameWidth​

Get Signature​

get frameWidth(): number

Defined in: src/core/Camera.ts:313

Get the frame width in world units.

Returns​

number

Set Signature​

set frameWidth(width): void

Defined in: src/core/Camera.ts:320

Set the frame width in world units.

Parameters​
width​

number

Returns​

void

Inherited from​

Camera2D.frameWidth


position​

Get Signature​

get position(): Vector3

Defined in: src/core/Camera.ts:363

Get the camera position.

Returns​

Vector3

Inherited from​

Camera2D.position

Methods​

getCamera()​

getCamera(): OrthographicCamera

Defined in: src/core/Camera.ts:380

Get the underlying Three.js OrthographicCamera.

Returns​

OrthographicCamera

The OrthographicCamera instance

Inherited from​

Camera2D.getCamera


getMappingFunction()​

getMappingFunction(): MappingFunction

Defined in: src/core/CameraExtensions.ts:1034

Get the current mapping function.

Returns​

MappingFunction

The mapping function, or null if none is set


mapPoint()​

mapPoint(point): Vector3Tuple

Defined in: src/core/CameraExtensions.ts:1044

Apply the mapping function to a point. Returns the point unchanged if no mapping is set (identity).

Parameters​

point​

Vector3Tuple

Input point [x, y, z]

Returns​

Vector3Tuple

The mapped point


moveTo()​

moveTo(point): void

Defined in: src/core/Camera.ts:371

Move the camera to a specific point.

Parameters​

point​

[number, number, number]

Target position [x, y, z]

Returns​

void

Inherited from​

Camera2D.moveTo


resetMapping()​

resetMapping(): this

Defined in: src/core/CameraExtensions.ts:1055

Clear the mapping function, reverting to identity.

Returns​

this

this for chaining


setAspectRatio()​

setAspectRatio(aspectRatio): void

Defined in: src/core/Camera.ts:389

Update the frame dimensions to match an aspect ratio. Useful for responsive layouts.

Parameters​

aspectRatio​

number

Width / height ratio

Returns​

void

Inherited from​

Camera2D.setAspectRatio


setMappingFunction()​

setMappingFunction(fn): this

Defined in: src/core/CameraExtensions.ts:1025

Set the mapping function used to transform coordinates.

Parameters​

fn​

MappingFunction

Mapping function that transforms [x, y, z] points

Returns​

this

this for chaining


updateFrame()​

updateFrame(dt): void

Defined in: src/core/Camera.ts:428

Run updaters on the camera frame (if it exists). Called by Scene after the timeline update so camera updaters see the latest positions set by animations.

Parameters​

dt​

number

Returns​

void

Inherited from​

Camera2D.updateFrame