Skip to main content

Class: Camera3D

Defined in: src/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: src/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: src/core/Camera.ts:89

Get the field of view.

Returns​

number


lookAtTarget​

Get Signature​

get lookAtTarget(): Vector3

Defined in: src/core/Camera.ts:82

Get the look-at target.

Returns​

Vector3


position​

Get Signature​

get position(): Vector3

Defined in: src/core/Camera.ts:75

Get the camera position.

Reads the live Three.js camera position so external drivers (e.g. OrbitControls, which mutate the camera directly) are reflected.

Returns​

Vector3

Methods​

getCamera()​

getCamera(): PerspectiveCamera

Defined in: src/core/Camera.ts:65

Get the underlying Three.js PerspectiveCamera.

Returns​

PerspectiveCamera

The PerspectiveCamera instance


getOrbitAngles()​

getOrbitAngles(): object

Defined in: src/core/Camera.ts:191

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

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

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

Update the aspect ratio.

Parameters​

ratio​

number

Width / height ratio

Returns​

this

this for chaining


setFov()​

setFov(fov): this

Defined in: src/core/Camera.ts:121

Set the field of view.

Parameters​

fov​

number

Field of view in degrees

Returns​

this

this for chaining


setLookAt()​

setLookAt(target): this

Defined in: src/core/Camera.ts:110

Set the look-at target.

Parameters​

target​

[number, number, number]

Target point [x, y, z]

Returns​

this

this for chaining