Web scene - slide tour

This sample demonstrates how to create an animated tour of the slides in a WebScene by using the applyTo() method. applyTo() returns a promise that resolves after the slide has been applied to the view. By chaining the applyTo() method of the slides, we can play through all the slides without user input.

The chaining is done with a recursive function:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// slides  is the array of slides from the webscene
const slides = scene.presentation.slides;

function goToSlide(i) {
  const slide = slides.getItemAt(i);

  if (i < slides.length) {
    infoDiv.innerHTML = slide.title.text;
    // call the applyTo method on the current slide
    slide
      .applyTo(view, { duration: 3000 })
      // and after the slide was applied to the view wait for 8 seconds
      // and then call goToSlide for the next slide
      .then(() => {
        window.setTimeout(() => {
          goToSlide(i + 1);
        }, 8000);
      });
  }
}

// go to the first slide - this function triggers the chaining
goToSlide(1);

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

The developer dashboard has moved

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close