Class: CameraApiInterface

CameraApiInterface~ CameraApiInterface

Interface for the CameraApi.

Methods

addEventListener(type, callback)

Add a callback to be invoked when a certain event occurs

Parameters:
Name Type Description
type CameraEventType

Type of event to subscribe to

callback EventListenerCallback

Function to be called when the event fires

Returns:
Type Description
APIResponse

APIResponse with an EventListenerToken object. The event listener token can be used to remove the event listener by calling removeEventListener.

<abstract> animateAsync(path [, transition])

Animate camera along a path. The camera starts at the first position of the path, so if the camera should start from the current position, add it to the start of the path.

Parameters:
Name Type Argument Description
path Array.<CameraDefinition>

Array of camera definition objects defining a camera path

transition TransitionParameters <optional>

Definition of the parameters to use for the transition (tween)

Returns:
Type Description
Promise.<APIResponse>

APIResponse with a CameraDefinition according to the camera's final position.

<abstract> get()

Returns the position and target of the camera as a CameraDefinition. If no target is available for this type of camera, the property target is undefined.

Returns:
Type Description
APIResponse

APIResponse with a CameraDefinition.

removeEventListener(token)

Remove an event listener

Parameters:
Name Type Description
token EventListenerToken

event listener token for event listener to be removed

Returns:
Type Description
APIResponse

APIResponse with a Boolean data, indicating whether the event listener could be removed.

<abstract> resetAsync( [transition])

Reset camera to its currently configured default configuration

Parameters:
Name Type Argument Description
transition TransitionParameters <optional>

Definition of the parameters to use for the transition (tween)

Returns:
Type Description
APIResponse

APIResponse with a CameraDefinition of the camera's default definition.

<abstract> updateAsync(camera [, transition])

Update camera

If target and/or position are provided, the camera will be moved to its new orientation

Parameters:
Name Type Argument Description
camera CameraDefinition

The new camera properties

transition TransitionParameters <optional>

Definition of the parameters to use for the transition (tween)

Returns:
Type Description
Promise.<APIResponse>

APIResponse with a CameraDefinition according to the new properties.

<abstract> updateMatrices(viewMatrix, projectionMatrix)

Update camera based on raw camera view and projection matrices.

When providing raw updates to the camera matrices, the camera controls should typically be disabled using setting scene.camera.enableCameraControls

Parameters:
Name Type Description
viewMatrix THREE.Matrix4

camera view matrix, transforming world coordinates to camera coordinates

projectionMatrix THREE.Matrix4

camera projection matrix

<abstract> zoomAsync( [scenePathsOrBB] [, transition])

Zoom to show some or all objects in the scene

Parameters:
Name Type Argument Description
scenePathsOrBB Array.<ScenePathType> | THREE.Box3 <optional>

The paths of the scene which the camera should capture or a 3D box which should be encapsulated afterwards. If none are provided, the camera will zoom to the scene extents.

transition TransitionParameters <optional>

Definition of the parameters to use for the transition (tween)

Returns:
Type Description
Promise.<APIResponse>

APIResponse with a CameraDefinition of the camera's new orientation.

Members

<readonly> CONTROLTYPE :ControlType

Enum for control types.

Type:
  • ControlType
Properties:
Name Type Default Description
ORBIT ControlType 0

the orbit controls (default for perspective camera)

FPS ControlType 1

the fps controls

ORTHOGRAPHIC ControlType 2

the orthographic controls (default for orthograhpic camera)

<readonly> EVENTTYPE :CameraEventType

Enum for supported camera event types.

Type:
Properties:
Name Type Default Description
CAMERA_START CameraEventType start

a camera movement has started

CAMERA_MOVE CameraEventType move

a camera movement has been continued

CAMERA_END CameraEventType end

a camera movement has ended

<readonly> TYPE :CameraType

Enum for camera types.

Type:
Properties:
Name Type Default Description
PERSPECTIVE CameraType 0

perspective camera

TOP CameraType 1

orthographic camera, top view

BOTTOM CameraType 2

orthographic camera, bottom view

RIGHT CameraType 3

orthographic camera, right view

LEFT CameraType 4

orthographic camera, left view

BACK CameraType 5

orthographic camera, back view

FRONT CameraType 6

orthographic camera, front view

AR CameraType 7

AR camera

Type Definitions

CameraDefinition

The camera definition including the camera's position and target as Point3d.

Type:
  • Object
Properties:
Name Type Description
position Point3d

The position of the camera in the scene

target Point3d

The position of the target in the scene

TransitionParameters

Definition of a transition function for camera movements

Type:
  • Object
Properties:
Name Type Argument Default Description
default Boolean <optional>
false

If true store final camera position and target as default.

duration Number <optional>
1000

duration of the transition in milliseconds

easing String | function <optional>
'Quartic.InOut'

In case a string S is provided, the corresponding easing function TWEEN.Easing[S] will be used if it exists. The easing function may also be passed directly, e.g. one of the many provided by Tween, see also TweenExplained, or a manually defined one.

interpolation String <optional>
'CatmullRom'

In case a string S is provided, the corresponding interpolation function TWEEN.Interpolation[S] will be used if it exists. Tween supports Linear, Bezier, and CatmullRom.

coordinates String <optional>
'cylindrical'

Defines coordinate system to use for animated camera paths. One of 'spherical' or 'cylindrical'.

ShapeDiver 3D Viewer, Copyright © 2015-2019 ShapeDiver GmbH. Documentation generated by JSDoc 3.6.5 on Tue Sep 8th 2020 using the DocStrap template.