Skip to main content

Class: Camera3D

Defined in: core/Camera.ts:26

3D camera for manimweb scenes. Wraps Three.js PerspectiveCamera with orbit controls support.

Extended by

Constructors

Constructor

new Camera3D(aspectRatio, options?): Camera3D

Defined in: core/Camera.ts:39

Create a new 3D camera.

Parameters

aspectRatio

number = ...

Width / height ratio. Defaults to 16/9.

options?

Camera3DOptions

Camera configuration options

Returns

Camera3D

Accessors

fov

Get Signature

get fov(): number

Defined in: core/Camera.ts:86

Get the field of view.

Returns

number


lookAtTarget

Get Signature

get lookAtTarget(): Vector3

Defined in: core/Camera.ts:79

Get the look-at target.

Returns

Vector3


position

Get Signature

get position(): Vector3

Defined in: core/Camera.ts:72

Get the camera position.

Returns

Vector3

Methods

getCamera()

getCamera(): PerspectiveCamera

Defined in: core/Camera.ts:65

Get the underlying Three.js PerspectiveCamera.

Returns

PerspectiveCamera

The PerspectiveCamera instance


getOrbitAngles()

getOrbitAngles(): object

Defined in: core/Camera.ts:186

Get spherical coordinates relative to the look-at point.

Returns

object

Object with phi (polar), theta (azimuthal), and distance

distance

distance: number

phi

phi: number

theta

theta: number


moveTo()

moveTo(position): this

Defined in: core/Camera.ts:95

Move the camera to a specific position.

Parameters

position

[number, number, number]

Target position [x, y, z]

Returns

this

this for chaining


orbit()

orbit(phi, theta, distance?, gamma?): this

Defined in: core/Camera.ts:154

Orbit the camera around the look-at point using spherical coordinates.

Mathematical convention:

  • theta: rotation around Z axis (azimuthal)
  • phi: distance from Z axis (polar, 0 = on axis)

Default (phi=0, theta=-π/2): camera at +Z looking at origin.

  • X axis → screen right
  • Y axis → screen up
  • Z axis → depth (pointing toward viewer)

Parameters

phi

number

Polar angle from Z axis (0 = on axis, PI/2 = side, PI = opposite)

theta

number

Azimuthal angle around Z axis (radians)

distance?

number

Optional distance from look-at point

gamma?

number = 0

Roll angle (radians)

Returns

this

this for chaining


setAspectRatio()

setAspectRatio(ratio): this

Defined in: core/Camera.ts:130

Update the aspect ratio.

Parameters

ratio

number

Width / height ratio

Returns

this

this for chaining


setFov()

setFov(fov): this

Defined in: core/Camera.ts:118

Set the field of view.

Parameters

fov

number

Field of view in degrees

Returns

this

this for chaining


setLookAt()

setLookAt(target): this

Defined in: core/Camera.ts:107

Set the look-at target.

Parameters

target

[number, number, number]

Target point [x, y, z]

Returns

this

this for chaining