Constructor
new Scene(viewer, view)
Parameters:
Name | Type | Description |
---|---|---|
viewer |
Viewer | The viewer this scene belongs to. |
view |
View | The scene's underlying view. |
Methods
createLayer(opts) → {Layer}
Creates a new layer and adds it into the scene in the foreground position.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
Object | Layer creation options. Properties
|
Returns:
- Type
- Layer
destroy()
Destructor. Clients should call Viewer#destroyScene instead.
destroyAllLayers()
Destroys all layers and removes them from the scene.
destroyLayer(layer)
Destroys a layer and removes it from the scene.
Parameters:
Name | Type | Description |
---|---|---|
layer |
Layer |
Throws:
An error if the layer does not belong to the scene.
hotspotContainer() → {Layer}
Returns the hotspot container for the scene.
Returns:
- Type
- Layer
layer() → {Layer}
Returns the first of the layers belonging to the scene, or null if the scene has no layers.
This method is equivalent to Scene#listLayers[0]
. It may be removed in the
future.
Returns:
- Type
- Layer
listLayers() → {Array.<Layer>}
Returns a list of all layers belonging to the scene. The returned list is in display order, background to foreground.
Returns:
- Type
- Array.<Layer>
lookTo(params, opts, done)
Tweens the scene's underlying view.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object | Target view parameters. |
|||||||||||||||||||||||||
opts |
Object | Transition options. Properties
|
|||||||||||||||||||||||||
done |
function | Function to call when the tween finishes or is interrupted. |
movement() → {function}
Returns the current movement.
Returns:
- Type
- function
startMovement(fn, done)
Starts a movement, possibly replacing the current movement.
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | The movement function. |
done |
function | Function to be called when the movement finishes or is interrupted. |
stopMovement()
Stops the current movement.
switchTo(opts, done)
Switches to the scene.
This is equivalent to calling Viewer#switchScene on this scene.
Parameters:
Name | Type | Description |
---|---|---|
opts |
Object | Options to pass into Viewer#switchScene. |
done |
function | Function to call when the switch is complete. |
view() → {View}
Returns the scene's underlying view.
Returns:
- Type
- View
viewer() → {Viewer}
Returns the viewer the scene belongs to.
Returns:
- Type
- Viewer
visible() → {boolean}
Returns whether the scene is currently visible.
Returns:
- Type
- boolean
Events
layerChange
Signals that the scene's layers have changed.
viewChange
Signals that the scene's view has changed. See View#event:change.