new Controls(type, camera, target, domElement, rotateSpeedopt, zoomSpeedopt, panSpeedopt)
Create Camera Controls.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string | Type of controls: "orbit", "trackball". | ||
camera |
THREE.Camera | The camera object. | ||
target |
THREE.Vector3 | The lookAt target for the camera. | ||
domElement |
canvas | The dom element of the rendering canvas. | ||
rotateSpeed |
number |
<optional> |
1.0 | Speed for rotating. |
zoomSpeed |
number |
<optional> |
1.0 | Speed for zooming. |
panSpeed |
number |
<optional> |
1.0 | Speed for panning. |
- Source:
Methods
addChangeListener(domEventCallback)
Add an event listener callback for the "change" event.
Parameters:
Name | Type | Description |
---|---|---|
domEventCallback |
callback | the callback function. |
- Source:
dispose()
Remove assets and event handlers.
- Source:
getResetLocation() → {object}
Get reset location value.
- Source:
Returns:
- target, position, quaternion, zoom as object.
- Type
- object
getTarget() → {THREE.Vector3}
Get the lookAt target of the camera.
- Source:
Returns:
The lookAt target
- Type
- THREE.Vector3
getZoom0()
Get the initial zoom value of the camera.
- Source:
initOrbitControls()
Initialize Orbit Controls.
- Source:
initTrackballControls(holroydopt)
Initialize Trackball Controls.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
holroyd |
boolean |
<optional> |
true | enable holroyd (non tumbling) mode. |
- Source:
removeChangeListener()
Remove the event listener callback for the "change" event.
- Source:
reset()
Reset camera to initial (automatically saved) state of position, up, quaternion and zoom.
- Source:
rotateLeft(angle)
Rotate camera left (OrbitControls only)
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | the angle to rotate. |
- Source:
rotateUp(angle)
Rotate camera up (OrbitControls only)
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | the angle to rotate. |
- Source:
rotateX(angle)
Rotate camera around x-axis (TrackballControls only)
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | the angle to rotate. |
- Source:
rotateY(angle)
Rotate camera around y-axis (TrackballControls only)
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | the angle to rotate. |
- Source:
rotateZ(angle)
Rotate camera around z-axis (TrackballControls only)
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | the angle to rotate. |
- Source:
saveState()
Save state for reset.
- Source:
setCamera(camera)
Set the camera to be controlled.
Parameters:
Name | Type | Description |
---|---|---|
camera |
THREE.Camera | a threejs Camera object. |
- Source:
setHolroydTrackball(flag)
Change the trackball holroyd (non tumbling) flag.
Parameters:
Name | Type | Description |
---|---|---|
flag |
boolean | a threejs Camera object. |
- Source:
setPanSpeed(val)
Set the pan speed.
Parameters:
Name | Type | Description |
---|---|---|
val |
number | the speed value. |
- Source:
setResetLocation(target, position, notifyopt) → {Array.<number>}
Set reset location value.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
Array.<number> | camera target as THREE.Vector3. | ||
position |
Array.<number> | camera position as THREE.Vector3. | ||
notify |
boolean |
<optional> |
true | whether to send notification or not. |
- Source:
Returns:
camera rotation as THREE.Quaternion.
- Type
- Array.<number>
setRotateSpeed(val)
Set the rotate speed.
Parameters:
Name | Type | Description |
---|---|---|
val |
number | the speed value. |
- Source:
setTarget(target)
Get the lookAt target of the camera.
Parameters:
Name | Type | Description |
---|---|---|
target |
Array.<number> | camera target as THREE.Vector3. |
- Source:
setZoomSpeed(val)
Set the zoom speed.
Parameters:
Name | Type | Description |
---|---|---|
val |
number | the speed value. |
- Source:
update()
Update controls after camera position, zoom or quaternion changes.
- Source: