Class: Scene

Scene(viewer, layer)

A @link{Scene} is a Layer with associated View and Effects that may be rendered inside a Viewer. Client code should call Viewer#createScene instead of invoking the constructor directly.

Constructor

new Scene(viewer, layer)

Parameters:
Name Type Description
viewer Viewer
layer Layer

Methods

_destroy()

Destructor. Client code should call Viewer#destroyScene instead.

hotspotContainer() → {Layer}

Get the scene's @link{HotspotContainer hotspot container}.

Returns:
Type
Layer

layer() → {Layer}

Get the scene's underlying @link{Layer layer}.

Returns:
Type
Layer

lookTo(params, opts, done)

Tween the scene's underlying @link{View view}.

Parameters:
Name Type Description
params Object

Target view parameters.

opts Object
Properties
Name Type Attributes Default Description
transitionDuration Number <optional>
1000

Tween duration in milliseconds.

closest Number <optional>
true

Whether to take the shortest path when tweening; requires View#normalizeToClosest to be implemented.

done function

Called when the tween finishes or is interrupted.

movement() → {function}

Return the current movement.

Returns:
Type
function

startMovement(fn, done)

Start a movement.

Parameters:
Name Type Description
fn function

Movement function.

done function

Called when the movement finishes.

stopMovement()

Stop the current movement.

switchTo(opts, done)

Switch to the scene, as would be obtained by calling Viewer#switchScene.

Parameters:
Name Type Description
opts Object

Options to pass into Viewer#switchScene.

done Object

Called when the scene switch is complete.

view() → {View}

Get the scene's underlying @link{View view}.

Returns:
Type
View

viewer() → {Viewer}

Get the @link{Viewer viewer} the scene belongs to.

Returns:
Type
Viewer

visible() → {boolean}

Whether the scene is currently visible.

Returns:
Type
boolean

Events

viewChange

Signals that the scene's view has changed. See View#event:change.