A slide stores a snapshot of several pre-set properties of the WebScene and SceneView, such as the basemap, viewpoint and visible layers. The visible layers may contain references (by Layer) to both operational layers from the scene as well as elevation layers from the ground, which affect the surface elevation.
Slides contain additional metadata such as a title, description and thumbnail which may be used to present the slide to the user in a user interface. Slides can be created, updated and applied to a SceneView. Additionally, slides can be stored as part of the WebScene.presentation.
// Create a slide from a view and apply it at a later time
Slide.createFrom(view).then(function(slide) {
// Add slide to the scene presentation
scene.presentation.slides.add(slide);
});
// At a later time
var firstSlide = scene.presentation.slides.getItemAt(0);
firstSlide.applyTo(view).then(function() {
// Slide has been successfully applied to the view
});
Constructors
new Slide(properties)
Create a new slide instance. Usually Slide.createFrom is used instead to create a new slide which stores a snapshot of the view.
properties Object See the properties for a list of all the properties that may be passed into the constructor. |
Property Overview
Name | Type | Summary | |
---|---|---|---|
Basemap | String | The basemap of the scene. more details | more details | |
String | The name of the class. more details | more details | |
Accessor | The description of the slide. more details | more details | |
Environment | Represents settings that affect the environment in which the WebScene is displayed (such as lighting). more details | more details | |
String | The unique id of a slide within the slides property of a Presentation. more details | more details | |
Accessor | A data URI encoded thumbnail. more details | more details | |
Accessor | The title of the slide. more details | more details | |
Viewpoint | The viewpoint of the slide. more details | more details | |
Collection | The visible layers of the scene. more details | more details |
Property Details
The basemap of the scene. Only the base and reference layers of the basemap are stored in a slide.
This value can be an instance of Basemap or one of the strings listed in the table below.
Value Description streets satellite hybrid topo gray dark-gray oceans national-geographic terrain osm declaredClassStringreadonly
The name of the class. The declared class name is formatted as
esri.folder.className
.descriptionAccessor
The description of the slide.
Property:optionaltext StringThe description.
environmentEnvironment autocast
Represents settings that affect the environment in which the WebScene is displayed (such as lighting).
idString
The unique id of a slide within the slides property of a Presentation.
thumbnailAccessor
A data URI encoded thumbnail.
Property:optionalurl StringThe URI pointing to the thumbnail image representing the slide.
titleAccessor
The title of the slide.
Property:optionaltext StringThe title.
The viewpoint of the slide. This acts like a bookmark, saving a predefined location or point of view from which to view the scene.
visibleLayersCollection autocast
The visible layers of the scene. This is a collection of objects that stores references (by ID) to the scene layers and ground layers that are set as
visible
when a slide is applied to a SceneView.When assigning visible layers, the following types of values will be automatically casted:
- Array (or Collection) of Layer instances:
[layerInstance, layerInstance]
- Array (or Collection) of Layer IDs:
["layer-1", "layer-2"]
The specification for each object in the collection is outlined in the table below.
Example:// Update the visible layers to the second layer in the scene, and the // first elevation layer in the ground. slide.visibleLayers = [ { id: scene.layers.getItemAt(1).id } { id: scene.ground.layers.getItemAt(0).id } ]; // Equivalent using convenience autocasting slide.visibleLayers = [scene.layers.getItemAt(0), scene.ground.layers.getItemAt(0)];
- Array (or Collection) of Layer instances:
Method Overview
Name | Return Type | Summary | |
---|---|---|---|
Promise | Applies a slide's settings to a SceneView. more details | more details | |
Slide | Creates a deep clone of this object. more details | more details | |
Promise | Creates a slide from a SceneView, which may be added to the slides in the WebScene's presentation. more details | more details | |
Promise | Updates a slide from a WebScene's slides. more details | more details |
Method Details
applyTo(view, options){Promise}
Applies a slide's settings to a SceneView.
Parameters:view SceneViewThe SceneView the slide should be applied to.
optionaloptions ObjectAnimation options. See properties below for object specifications.
Specification:animate BooleanIndicates whether to animate the slide transition. Default is
true
.optionalspeedFactor NumberIncreases or decreases the animation speed by the specified factor. A speedFactor of 2 will make the animation twice as fast, while a speedFactor of 0.5 will make the animation half as fast. Setting the speed factor will automatically adapt the default maxDuration accordingly.
Default Value: 1optionalduration NumberSet the exact duration (in milliseconds) of the animation. Note that by default, animation duration is calculated based on the time required to reach the target at a constant speed. Setting duration overrides the speedFactor option. Note that the resulting duration is still limited to the maxDuration.
optionalmaxDuration NumberThe maximum allowed duration (in milliseconds) of the animation. The default maxDuration value takes the specified speedFactor into account.
Default Value: 8000 / speedFactoroptionaleasing String | EasingFunctionThe easing function to use for the animation. This may either be a preset (named) function, or a user specified function. Supported named presets are:
linear
,in-cubic
,out-cubic
,in-out-cubic
,in-expo
,out-expo
,in-out-expo
By default, animations that are less than 1000 ms use an out easing function; longer animations use an in-out function.Returns:Type Description Promise When resolved, returns the updated slide. Examples:// Applies the slide's settings to the view, but does // not use animation when updating the viewpoint slide.applyTo(view, { animate: false });
// Applies the slide's settings to the view, animates with a maximum // duration of 2 seconds. slide.applyTo(view, { maxDuration: 2000 });
slide.applyTo(view, { maxDuration: 2000 }).then(function(){ //do something after applying the slide's settings to the view });
clone(){Slide}
Creates a deep clone of this object. Note that the basemap instance is cloned, but the layers within the basemap are copied.
Returns:Type Description Slide A new Slide instance. createFrom(view, options){Promise}static
Creates a slide from a SceneView, which may be added to the slides in the WebScene's presentation. Updating the slide is asynchronous and a snapshot of the view is only complete once the returned promise has resolved.
Parameters:view SceneViewThe SceneView from which the slide should be created.
optionaloptions ObjectCreation options. See properties below for object specifications.
Parameters:screenshot ObjectScreenshot options to use. See properties below for object specifications.
Specification:format StringThe image format. Default is
jpeg
.quality NumberThe image quality (due to compression). Default is
80
.width NumberThe image width. Default is
112
.height NumberThe image height. Default is
61
.Returns:Type Description Promise When resolved, returns the created slide. Examples:// Creates a slide from the view and // adds it to the webscene Slide.createFrom(view).then(function(slide){ webscene.presentation.slides.add(slide); });
// Create multiple slides from multiple viewpoints. view.goTo({ heading: 0 }, { animate: false }) .then(function() { // Create first slide at heading 0 (looking north) return Slide.createFrom(view); }) .then(function(slide){ // Slide has been captured, add to presentation webscene.presentation.slides.add(slide); // Change viewpoint to look east return view.goTo({ heading: 90 }, { animate: false }); }) .then(function() { // Capture second slide return Slide.createFrom(view); }) .then(function(slide) { // Add second slide to presentation webscene.presentation.slides.add(slide); });
updateFrom(view, options){Promise}
Updates a slide from a WebScene's slides. Updating the slide is asynchronous and a snapshot of the view is only complete once the returned promise has resolved.
Parameters:view SceneViewThe SceneView from which the slide should update.
optionaloptions ObjectUpdate options. See properties below for object specifications.
Parameters:screenshot ObjectScreenshot options to use. See properties below for object specifications.
Specification:format StringThe image format. Default is
jpeg
.quality NumberThe image quality (due to compression). Default is
80
.width NumberThe image width. Default is
120
.height NumberThe image height. Default is
75
.Returns:Type Description Promise When resolved, returns the updated slide.