Skip to main content

Class: CameraFrame

Defined in: src/core/CameraFrame.ts:44

CameraFrame wraps a Camera3D and exposes ManimGL-compatible Euler angle methods for both immediate use and animation (via the .animate proxy).

Constructors​

Constructor​

new CameraFrame(aspectRatio, options): CameraFrame

Defined in: src/core/CameraFrame.ts:60

Parameters​

aspectRatio​

number = ...

options​

CameraFrameOptions = {}

Returns​

CameraFrame

Properties​

mobjectStub​

readonly mobjectStub: Mobject

Defined in: src/core/CameraFrame.ts:58

A lightweight Mobject stub used as the Animation target. This lets CameraAnimation integrate with the existing Timeline / Scene.play() system which requires every Animation to have a .mobject.

Accessors​

animate​

Get Signature​

get animate(): CameraAnimateProxy

Defined in: src/core/CameraFrame.ts:269

Returns a proxy that records camera state changes and produces a CameraAnimation when called with scene.play().

Usage (property, default 1s smooth): scene.play(frame.animate.incrementPhi(PI/4)) scene.play(frame.animate.setEulerAngles({ theta: PI/4, phi: PI/3 }))

Usage (method with options): scene.play(frame.animateTo({ duration: 2 }).incrementPhi(PI/4))

Returns​

CameraAnimateProxy

Methods​

_applyState()​

_applyState(state): void

Defined in: src/core/CameraFrame.ts:242

Apply a full camera state.

Parameters​

state​

CameraFrameState

Returns​

void


_snapshot()​

_snapshot(): CameraFrameState

Defined in: src/core/CameraFrame.ts:230

Capture the current camera state.

Returns​

CameraFrameState


animateTo()​

animateTo(options): CameraAnimateProxy

Defined in: src/core/CameraFrame.ts:276

Like animate, but accepts AnimationOptions (duration, rateFunc).

Parameters​

options​

AnimationOptions = {}

Returns​

CameraAnimateProxy


getCamera3D()​

getCamera3D(): Camera3D

Defined in: src/core/CameraFrame.ts:90

Get the underlying Camera3D instance.

Returns​

Camera3D


getCenter()​

getCenter(): Vector3Tuple

Defined in: src/core/CameraFrame.ts:207

Get the look-at center.

Returns​

Vector3Tuple


getDistance()​

getDistance(): number

Defined in: src/core/CameraFrame.ts:183

Get the distance from the look-at target.

Returns​

number


getEulerAngles()​

getEulerAngles(): [number, number, number]

Defined in: src/core/CameraFrame.ts:104

Get the current Euler angles [theta, phi, gamma].

Returns​

[number, number, number]


getFieldOfView()​

getFieldOfView(): number

Defined in: src/core/CameraFrame.ts:195

Get the current field of view in degrees.

Returns​

number


getGamma()​

getGamma(): number

Defined in: src/core/CameraFrame.ts:160

Get the current gamma (roll) angle.

Returns​

number


getPhi()​

getPhi(): number

Defined in: src/core/CameraFrame.ts:141

Get the current phi (polar) angle.

Returns​

number


getTheta()​

getTheta(): number

Defined in: src/core/CameraFrame.ts:122

Get the current theta (azimuthal) angle.

Returns​

number


getThreeCamera()​

getThreeCamera(): PerspectiveCamera

Defined in: src/core/CameraFrame.ts:95

Get the underlying Three.js PerspectiveCamera.

Returns​

PerspectiveCamera


incrementGamma()​

incrementGamma(delta): this

Defined in: src/core/CameraFrame.ts:172

Increment the gamma (roll) angle by delta.

Parameters​

delta​

number

Returns​

this


incrementPhi()​

incrementPhi(delta): this

Defined in: src/core/CameraFrame.ts:153

Increment the phi (polar) angle by delta.

Parameters​

delta​

number

Returns​

this


incrementTheta()​

incrementTheta(delta): this

Defined in: src/core/CameraFrame.ts:134

Increment the theta (azimuthal) angle by delta.

Parameters​

delta​

number

Returns​

this


moveTo()​

moveTo(point): this

Defined in: src/core/CameraFrame.ts:212

Move the look-at center to a point. Camera position updates accordingly.

Parameters​

point​

Vector3Tuple

Returns​

this


setAspectRatio()​

setAspectRatio(ratio): this

Defined in: src/core/CameraFrame.ts:220

Set the aspect ratio of the underlying camera.

Parameters​

ratio​

number

Returns​

this


setDistance()​

setDistance(value): this

Defined in: src/core/CameraFrame.ts:188

Set the distance from the look-at target.

Parameters​

value​

number

Returns​

this


setEulerAngles()​

setEulerAngles(opts): this

Defined in: src/core/CameraFrame.ts:112

Set Euler angles (absolute). Any parameter left undefined is unchanged.

Parameters​

opts​
gamma?​

number

phi?​

number

theta?​

number

Returns​

this

this for chaining


setFieldOfView()​

setFieldOfView(fov): this

Defined in: src/core/CameraFrame.ts:200

Set the field of view in degrees.

Parameters​

fov​

number

Returns​

this


setGamma()​

setGamma(value): this

Defined in: src/core/CameraFrame.ts:165

Set the gamma (roll) angle absolutely.

Parameters​

value​

number

Returns​

this


setPhi()​

setPhi(value): this

Defined in: src/core/CameraFrame.ts:146

Set the phi (polar) angle absolutely.

Parameters​

value​

number

Returns​

this


setTheta()​

setTheta(value): this

Defined in: src/core/CameraFrame.ts:127

Set the theta (azimuthal) angle absolutely.

Parameters​

value​

number

Returns​

this