You are reading the documentation for the version 2 of the ShapeDiver viewer API. Free support for this viewer version will be discontinued on June 1st, 2024.

Please refer to the version 3 documentation here. See also the migration guide from version 2 to version 3 here.

Class: CameraApiInterface

CameraApiInterface~ CameraApiInterface

Interface for the CameraApi.

Methods

<abstract> animateAsync(path [, transition])

Animate camera along a 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
CameraDefinition

The current camera definition

<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 pause.

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> 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.3 on Thu Oct 17th 2019 using the DocStrap template.