Skip to main content

Class: Camera2D

Defined in: core/Camera.ts:186

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:196

Create a new 2D camera.

Parameters

options

CameraOptions = {}

Camera configuration options

Returns

Camera2D

Accessors

frame

Get Signature

get frame(): Camera2DFrame

Defined in: core/Camera.ts:289

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:237

Get the frame height in world units.

Returns

number

Set Signature

set frameHeight(height): void

Defined in: core/Camera.ts:244

Set the frame height in world units.

Parameters
height

number

Returns

void


frameWidth

Get Signature

get frameWidth(): number

Defined in: core/Camera.ts:222

Get the frame width in world units.

Returns

number

Set Signature

set frameWidth(width): void

Defined in: core/Camera.ts:229

Set the frame width in world units.

Parameters
width

number

Returns

void


position

Get Signature

get position(): Vector3

Defined in: core/Camera.ts:252

Get the camera position.

Returns

Vector3

Methods

getCamera()

getCamera(): OrthographicCamera

Defined in: core/Camera.ts:269

Get the underlying Three.js OrthographicCamera.

Returns

OrthographicCamera

The OrthographicCamera instance


moveTo()

moveTo(point): void

Defined in: core/Camera.ts:260

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:278

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:301

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