Back to the Shapespark home page

Navigate through scenes

Has somebody come across with a way to navigate through scenes in a “next” “previous” fashion?

The switchToView and onViewSwitchDone functions described here: https://github.com/shapespark/shapespark-viewer-api#view-switch should allow you to do it. A generic idea could be to keep a list of view names in JavaScript code, remember which view was last activated when a onViewSwitchDone is called, and activate the previous or the next view to this last activated view when a custom ‘next’ ‘previous’ buttons are clicked.

The example linked from this API document could be used as a staring point: https://demo.shapespark.com/api-examples-view-switch/#autoplay
https://github.com/shapespark/shapespark-viewer-api/blob/master/examples/view-switch/body-end.html

Hey @jan,

Thanks for the reply, I undestand your explanation…I was surfing through the walk.js and thought that maybe I could use switchToAdjacentView or so I dont remember exactly…and using an array composed of my views should do the work.
One last thing, I am just getting used to html, css and javascript, and I know is not your scope to help us out with customization but if you could help me out this time with a script for the tour button we have on the right bottom corner…because I already have my custom buttons but I’m struggling with the code. If you help me out with this then I can surely figure it out for the prev/next button.
Thanks.

Auto tour is not exposed via API, so you would need to try styling the existing button (it has an id ‘tour-button’), or implement own auto tour using switchToView API function.

1 Like

hey, great hint…the id button, thanks @jan!