Skip to main content

Class: MappingCamera

Defined in: core/CameraExtensions.ts:888

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: core/CameraExtensions.ts:895

Create a new MappingCamera.

Parameters

options

MappingCameraOptions = {}

Camera configuration options

Returns

MappingCamera

Overrides

Camera2D.constructor

Accessors

frame

Get Signature

get frame(): Camera2DFrame

Defined in: core/Camera.ts:322

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: core/Camera.ts:270

Get the frame height in world units.

Returns

number

Set Signature

set frameHeight(height): void

Defined in: core/Camera.ts:277

Set the frame height in world units.

Parameters
height

number

Returns

void

Inherited from

Camera2D.frameHeight


frameWidth

Get Signature

get frameWidth(): number

Defined in: core/Camera.ts:255

Get the frame width in world units.

Returns

number

Set Signature

set frameWidth(width): void

Defined in: core/Camera.ts:262

Set the frame width in world units.

Parameters
width

number

Returns

void

Inherited from

Camera2D.frameWidth


position

Get Signature

get position(): Vector3

Defined in: core/Camera.ts:285

Get the camera position.

Returns

Vector3

Inherited from

Camera2D.position

Methods

getCamera()

getCamera(): OrthographicCamera

Defined in: core/Camera.ts:302

Get the underlying Three.js OrthographicCamera.

Returns

OrthographicCamera

The OrthographicCamera instance

Inherited from

Camera2D.getCamera


getMappingFunction()

getMappingFunction(): MappingFunction

Defined in: core/CameraExtensions.ts:914

Get the current mapping function.

Returns

MappingFunction

The mapping function, or null if none is set


mapPoint()

mapPoint(point): Vector3Tuple

Defined in: core/CameraExtensions.ts:924

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: core/Camera.ts:293

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: core/CameraExtensions.ts:935

Clear the mapping function, reverting to identity.

Returns

this

this for chaining


setAspectRatio()

setAspectRatio(aspectRatio): void

Defined in: core/Camera.ts:311

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: core/CameraExtensions.ts:905

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: core/Camera.ts:334

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