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:
// Recursive function to animate between slides function goToSlide(i) { if (i < slides.length) { const slide = slides.getItemAt(i); button.style.display = "none";
// Update info for current slide titleDiv.textContent = slide.title.text || "Untitled slide"; descDiv.textContent = slide.description.text || "";
slide.applyTo(viewElement.view, { duration: 3000 }).then(() => { startProgressCountdown(); window.setTimeout(() => { goToSlide(i + 1); }, 8000); }); } else { // Tour finished button.style.display = "block"; progressBar.value = 100; } }