new CameraControls() → {CameraControls}
Provides the basic controls for a scene.
- Source:
Returns:
- Type
- CameraControls
Members
(inner, constant) CLICK_ACTION
Available click actions are MAIN, AUXILIARY and SECONARY.
Properties:
Type | Description |
---|---|
Object |
- Source:
(inner, constant) STATE
Actions states.
Available states are NONE, ROTATE, ZOOM, PAN, TOUCH_ROTATE, TOUCH_ZOOM, TOUCH_PAN and SCROLL.
Properties:
Type | Description |
---|---|
Object |
- Source:
Methods
addViewport(name, viewportName)
Add a viewport to the list of available named viewports.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Name of the viewport |
viewportName |
Viewport | Viewport to be added |
- Source:
autoTumble(tumbleDirectionIn, tumbleRateIn, stopOnCameraInputIn)
Setup auto tumble object of the camera which will rotate the camera
around the target as if the user is rotating the camera by mouse/touch
interaction.
The tumbling will only be enabled with enabelAutoTumble.
Parameters:
Name | Type | Description |
---|---|---|
tumbleDirectionIn |
Array | direction of the mouse/touch. |
tumbleRateIn |
Number | Speed of the tumbling. |
stopOnCameraInputIn |
Boolean | Disable the tumbling once the user start interacting with the scene. |
- Source:
calculatePathNow()
Force recalculation of the current path.
- Source:
cameraTransition(startingViewport, endingViewport, durationIn)
Setup a smooth transition object which transition the camera from one
viewport to the other in the specified duration. This will not work if
rotateCameraTransition is active.
To use this object, the transition must be enabled using
enableCameraTransition.
Parameters:
Name | Type | Description |
---|---|---|
startingViewport |
Viewport | the starting viewport |
endingViewport |
Viewport | the viewport ti end the transistion with. |
durationIn |
Number | duration of the smooth transition. |
- Source:
disable()
Disable the camera control.
- Source:
disableDeviceOrientation()
Disable rotation using the devices's accelerometer.
- Source:
disableRaycaster()
Disable raycaster and remove the internal ray caster object.
- Source:
disableSyncControl()
Disable syncControl.
- Source:
enable()
Enable the camera control.
- Source:
enableAutoTumble()
Enable autotumble.
- Source:
enableCameraTransition()
Enable camera transition, rotateCameraTransition amd
cameraTransition must be called before camera transition can
be enabled.
- Source:
enableDeviceOrientation()
Enable rotation using the devices's accelerometer.
- Source:
enableDirectionalLightUpdateWithPath(flag)
Enable directional light update as the camera
is traveling through path.
Parameters:
Name | Type | Description |
---|---|---|
flag |
Boolean |
- Source:
enableRaycaster(sceneIn, callbackFunctionIn, hoverCallbackFunctionIn)
Create an internal raycaster object and enable it for picking.
Parameters:
Name | Type | Description |
---|---|---|
sceneIn |
Scene | The scene to pick from, it can be different from the camera's scene. |
callbackFunctionIn |
requestCallback | The callback for pick event. |
hoverCallbackFunctionIn |
requestCallback | The callback for hover over event. |
- Source:
enableSyncControl()
Enable syncControl.
- Source:
getCurrentTimeFrame() → {Array}
Get the current time frame and it will return three values in
an array.
- Source:
Returns:
- bottom frame, top frame and the proportion.
- Type
- Array
getCurrentViewport() → {Viewport}
Get the current camera viewport.
- Source:
Returns:
- Type
- Viewport
getDefaultViewport() → {String}
Get the name of the default viewport.
- Source:
Returns:
- Type
- String
getNDCFromDocumentCoords(x, y, positionIn) → {THREE.Vector2}
Get normalised coordinates from windows coordinates.
Parameters:
Name | Type | Description |
---|---|---|
x |
String | |
y |
String | |
positionIn |
THREE.Vector2 | Optional, write the value into this object if it is provided, otherwise a new object will be created and returned. |
- Source:
Returns:
containing the normalised x and y coordinates.
- Type
- THREE.Vector2
getNumberOfTimeFrame() → {Number}
Get the number of frame which is determine by number of points
in the camera path.
- Source:
Returns:
- Type
- Number
getPlayRate() → {Number}
Get the playRate - this determines how fast it takes to
finish one duration.
- Source:
Returns:
- Type
- Number
getRelativeCoordsFromNDC(x, y, positionIn) → {THREE.Vector2}
Get the relative windows coordinates from normalised coordiantes.
Parameters:
Name | Type | Description |
---|---|---|
x |
String | |
y |
String | |
positionIn |
THREE.Vector2 | Optional, write the value into this object if it is provided, otherwise a new object will be created and returned. |
- Source:
Returns:
containing the relative x and y coordinates.
- Type
- THREE.Vector2
getTime() → {Number}
Get the current inbuild time,
- Source:
Returns:
- Type
- Number
getViewportFromBoundingBox(boundingBox) → {Viewport}
Get the viewport for the boudning box
Parameters:
Name | Type | Description |
---|---|---|
boundingBox |
Number | y coordinate of the centre. |
- Source:
Returns:
- Type
- Viewport
getViewportFromCentreAndRadius(centreX, centreY, centreZ, radius, view_angle, clip_distance) → {Viewport}
Get the viewport based on centre, radius, view_angle and clip distance.
Parameters:
Name | Type | Description |
---|---|---|
centreX |
Number | x coordinate of the centre. |
centreY |
Number | y coordinate of the centre. |
centreZ |
Number | z coordinate of the centre. |
radius |
Number | radius if the viewport. |
view_angle |
Number | view angle. |
clip_distance |
Number | clip_distance between the near and far plane. |
- Source:
Returns:
- Type
- Viewport
getViewportOfName(name) → {Viewport}
Get the viewport with the provied name stored in this object.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Name of the viewport |
- Source:
Returns:
- Type
- Viewport
isAutoTumble() → {Boolean}
Check rather autotumble is active.
- Source:
Returns:
- Type
- Boolean
isDeviceOrientationEnabled()
Check rather device orientation based on accelerometer is on.
- Source:
isPlayingPath() → {Boolean}
Check rather the control is currently in path mode.
- Source:
Returns:
- Type
- Boolean
isSyncControl() → {Boolean}
Check rather the camera is in syncControl mode.
- Source:
Returns:
- Type
- Boolean
isTransitioningCamera()
Check if camera transition is active.
- Source:
loadPathURL(path_url, finishCallback)
This is an experimental feature. It loads a path - point to point which
the camera will travel.
Parameters:
Name | Type | Description |
---|---|---|
path_url |
String | The path. |
finishCallback |
requestCallback | The callback once the path is load. |
- Source:
pauseCameraTransition()
Pause the camera transition.
- Source:
playPath()
Switch to path mode and begin traveling through the camera path.
- Source:
resetView()
Reset the viewport settings to the one provided by default viewport.
- Source:
rotateAboutLookAtpoint(axis, Angle)
Rotate around the axis with the amount specified by angle.
Parameters:
Name | Type | Description |
---|---|---|
axis |
THREE.Vector3 | The rotational axis. |
Angle |
Number | Specify how much the camera shoudl rotate by. |
- Source:
rotateCameraTransition(axis, angle, duration)
Setup a rotate camera transition object which rotate the
camera by the specified the angle in the specified
duration. This will not work if cameraTransition
is active.
To use this object, the transition must be enabled using
enableCameraTransition.
Parameters:
Name | Type | Description |
---|---|---|
axis |
THREE.Vector3 | the starting viewport |
angle |
Number | the viewport ti end the transistion with. |
duration |
Number | duration of the smooth transition. |
- Source:
setCurrentCameraSettings(newViewport)
Set the current camera settings with the provided viewport.
Parameters:
Name | Type | Description |
---|---|---|
newViewport |
Viewport | viewport settings. |
- Source:
setCurrentTimeFrame(targetTimeFrame)
Set the current time frame.
Parameters:
Name | Type | Description |
---|---|---|
targetTimeFrame |
Number | bottom frame, top frame and the proportion. |
- Source:
setCurrentViewport(name) → {Boolean}
Set the viewport with a name if it is found in the list.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Name of the viewport |
- Source:
Returns:
if viewport is found and set, otherwise false.
- Type
- Boolean
setDefaultViewport(defaultName) → {Boolean}
Set the default viewport for this CameraControls.
Parameters:
Name | Type | Description |
---|---|---|
defaultName |
String | Name of the viewport |
- Source:
Returns:
true if set successfully, false otherwise.
- Type
- Boolean
setMouseButtonAction(buttonName, actionName)
Map a mouse click to the specified action.
Parameters:
Name | Type | Description |
---|---|---|
buttonName |
String | please see CLICK_ACTION |
actionName |
String | please see STATE |
- Source:
setPathDuration(durationIn)
Set the duration for the camera to travel along the path.
Parameters:
Name | Type | Description |
---|---|---|
durationIn |
Number | the duration for the path. |
- Source:
setPlayRate(playRateIn)
Set the playRate - this determines how fast it takes to
finish one duration.
Parameters:
Name | Type | Description |
---|---|---|
playRateIn |
Number | The play rate speed. |
- Source:
setRotationMode(mode)
Set the direction of rotation allowed with this control.
Parameters:
Name | Type | Description |
---|---|---|
mode |
String | available options are none, horizontal, vertical and free. |
- Source:
setTime(timeIn)
Set the current inbuild time,
Parameters:
Name | Type | Description |
---|---|---|
timeIn |
Number | this will be used as the current time, it should be between the range of zero and the set duration. |
- Source:
stopAutoTumble()
Disable the autotumble.
- Source:
stopCameraTransition()
Stop the camera transition and remove camera transition
and rotate camera transition.
- Source:
stopPath()
Stop playing path and switch back to normal control.
- Source:
update(timeChanged)
Update all controls related changes - including calculation of the viewport.
Parameters:
Name | Type | Description |
---|---|---|
timeChanged |
Number | Time eclipse since last called. |
- Source:
updateAutoTumble()
Update the autotumble object.
- Source:
updateDirectionalLight()
Force an update to the position of the directional light.
- Source:
(inner) setCanvasTabindex(element, index)
Parameters:
Name | Type | Description |
---|---|---|
element |
HTML | |
index |
Number |
- Source:
(inner) updatePath(delta)
Update the progress on the path by the specified amount - delta.
Parameters:
Name | Type | Description |
---|---|---|
delta |
Number | The amount of time to increment |
- Source:
(inner) updateTime(delta)
Update the internal timer by the set amount, this can
be used to force a time update by setting delta to zero.
Parameters:
Name | Type | Description |
---|---|---|
delta |
Number | The amount of time to increment the time by. |
- Source: