mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.16k stars 712 forks source link

Auto loading of next scene? #1109

Open fleabeard69 opened 1 year ago

fleabeard69 commented 1 year ago

I would like to know if there are any ways to have 2 scenes in a tour? I do not wish to use hotspots and would much rather prefer it to either load the next scene automatically after a given period of time on the 1st scene, or to at least load the next scene after the 1st scene has completed a full revolution.

pannellum.viewer('panorama', {   
    "default": {
        "firstScene": "Banner 1",
        "sceneFadeDuration": 1000
    },

    "scenes": {
        "Banner 1": {
        "autoLoad": !0,
            "autoRotate": -10,
        "showZoomCtrl": !1,
            "keyboardZoom": !1,
            "mouseZoom": !1,
            "draggable": !1,
            "disableKeyboardCtrl": !1,
            "showControls": !1,
            "compass": false,
        "autoRotateInactivityDelay":3e3,
            "hfov": 160,
            "type": "equirectangular",
            "panorama": "assets/img/banner.jpg",
        },

        "Banner 2": {
        "autoLoad": !0,
            "autoRotate": -10,
        "showZoomCtrl": !1,
            "keyboardZoom": !1,
            "mouseZoom": !1,
            "draggable": !1,
            "disableKeyboardCtrl": !1,
            "showControls": !1,
            "compass": !1,
        "autoRotateInactivityDelay":3e3,
            "type": "equirectangular",
            "panorama": "assets/img/banner2.jpg",
        }
    }
});
mpetroff commented 1 year ago

You can use the loadScene API method to switch to a new scene. First, you need to assign the viewer to a variable, e.g., var viewer = pannellum.viewer(...);. Then you can call, e.g., viewer.loadScene('Banner 2');. You can use setTimeout to add a delay.