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:
// slides is the array of slides from the webscene
var slides = scene.presentation.slides;
function goToSlide(i){
var 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(function(){
window.setTimeout(function(){
goToSlide(i + 1);
}, 8000);
});
}
}
// go to the first slide - this function triggers the chaining
goToSlide(1);
Sample search results
Title | Sample |
---|
There were no match results from your search criteria.