Skip to main content

Class: Camera2D

Defined in: core/Camera.ts:261

2D camera for manimweb scenes. Wraps Three.js OrthographicCamera with Manim-style frame dimensions.

Extended by

Constructors

Constructor

new Camera2D(options): Camera2D

Defined in: core/Camera.ts:279

Create a new 2D camera.

Parameters

options

CameraOptions = {}

Camera configuration options

Returns

Camera2D

Accessors

aspectMode

Get Signature

get aspectMode(): Camera2DAspectMode

Defined in: core/Camera.ts:345

Get the current aspect-mode (see Camera2DAspectMode).

Returns

Camera2DAspectMode

Set Signature

set aspectMode(mode): void

Defined in: core/Camera.ts:353

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

Parameters
mode

Camera2DAspectMode

Returns

void


frame

Get Signature

get frame(): Camera2DFrame

Defined in: 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


frameHeight

Get Signature

get frameHeight(): number

Defined in: core/Camera.ts:329

Get the frame height in world units.

Returns

number

Set Signature

set frameHeight(height): void

Defined in: core/Camera.ts:336

Set the frame height in world units.

Parameters
height

number

Returns

void


frameWidth

Get Signature

get frameWidth(): number

Defined in: core/Camera.ts:313

Get the frame width in world units.

Returns

number

Set Signature

set frameWidth(width): void

Defined in: core/Camera.ts:320

Set the frame width in world units.

Parameters
width

number

Returns

void


position

Get Signature

get position(): Vector3

Defined in: core/Camera.ts:363

Get the camera position.

Returns

Vector3

Methods

getCamera()

getCamera(): OrthographicCamera

Defined in: core/Camera.ts:380

Get the underlying Three.js OrthographicCamera.

Returns

OrthographicCamera

The OrthographicCamera instance


moveTo()

moveTo(point): void

Defined in: core/Camera.ts:371

Move the camera to a specific point.

Parameters

point

[number, number, number]

Target position [x, y, z]

Returns

void


setAspectRatio()

setAspectRatio(aspectRatio): void

Defined in: 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


updateFrame()

updateFrame(dt): void

Defined in: 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