Question: How do I autorotate for one spin and then load the next xml?

  • Hi,

    Have a client that needs one auto rotation per pano and then loading the next xml. After all the xml files have been shown, it needs to go back to the first pano and restart. User controls must be functional on demand and then going back to an auto rotation set to change panos/xml again after a set period of time. I know it's out there. I went through the forums and docs but I'm still not sure what to use. Oh, it's still an older version of krpano (1.0.6) I think. Any suggestions on the code?

    Test Site

    http://www.esotericvision.com/vt/ham360ft/index.html

    Best Regards,

    Ben

  • In the every scene, in onstart action you set the value of global variable that represents the number of the scene, let say "sceneNo".
    Then you should have a plugin, or context menu that switch the "isautorotation" variable.
    Then, at the end of the onstart action you set:

    if(isautorotation == 1,delayedcall(60,openscene()));

    That means, after one minute the openscene action is raised.
    In that action you load another panorama in accordance to the number of current scene. For example:

    <action name="openscene">
    oninterrupt(break);
    if(sceneNo == 8, loadscene(sc9, null, MERGE, BLEND(1)); );
    if(sceneNo == 9, loadscene(sc30, null, MERGE, BLEND(1)); );
    </action>

    or you can call next scene directly:

    if(isautorotation == 1,delayedcall(60, loadscene(sc9, null, MERGE, BLEND(1))));


    Regards!
    Greg

  • Hey Greg!

    Thanks for the reply. I'm not good with actions. So let me follow this. Here's where I'm at right now. I've not set the parameters for the plug in and that's why I assume I'm getting an error. Here's the xml that the index page points to the page copied below. There are 12 actions (loadpano) but I've deleted the rest since other plug-ins and more of the same actions to get rid of clutter. Got a few questions. Is the syntax correct for krpano first of all? What types of parameters should be set for the plug-in "isautorotation"? What exactly is "isautorotation == 1" ? Thanks again! Anyone else want to chime in?

    Best Regards,

    Ben

    -----------------------------

    <krpano version="1.0.6" onstart="action(1); if(isautorotation == 1,delayedcall(30,openscene()));

    <autorotate enabled="true" horizon="0" accel="1.5" speed="7" waittime="2.0"/>


    <plugin name="isautorotation"

    />

    <action name="openscene">
    oninterrupt(break);
    if(action == 1, loadpano(2, null, MERGE, BLEND(1)); );
    if(action == 2, loadpano(3, null, MERGE, BLEND(1)); );
    if(action == 3, loadpano(4, null, MERGE, BLEND(1)); );
    if(action == 4, loadpano(5, null, MERGE, BLEND(1)); );
    if(action == 5, loadpano(6, null, MERGE, BLEND(1)); );
    if(action == 6, loadpano(7, null, MERGE, BLEND(1)); );
    if(action == 7, loadpano(8, null, MERGE, BLEND(1)); );
    if(action == 8, loadpano(9, null, MERGE, BLEND(1)); );
    if(action == 9, loadpano(10, null, MERGE, BLEND(1)); );
    if(action == 10, loadpano(11, null, MERGE, BLEND(1)); );
    if(action == 11, loadpano(12, null, MERGE, BLEND(1)); );
    if(action == 12, loadpano(1, null, MERGE, BLEND(1)); );
    </action>

    <action name="1">
    loadpano(./360files/lists/blank.xml,null,MERGE,BLEND(1));
    </action>

    <action name="2">
    loadpano(./360files/lists/blank1.xml,null,MERGE,BLEND(1));
    </action>

    ---------------------------------------

  • Hi!

    There is some piece of code I used (with only this code we need to explain):

    On the tour's start you set the variable "autopre" to 0.
    In the tour you put plugin let say "auto-button". After clicking the plugin you raise "startstop-autopre" action.
    This action switch "autopre" variable and reload scene.
    Every scene has onStart action, let say "scene9-start". In that action you have have delayedcall if the "autopre" is 1. In this delayed call you call "next-scene" action in which you load next scene in accordance to the current scene number (depending on "sceneNo" variable).


    I hope you understand now. *wink*

    Regards
    Greg

  • Hey Greg,

    I've got a basic version of an auto tour running. It's VERY basic though. I added the following code for the onstart in each different scene's xml. I'm just planning on adding the next panorama manually for the next image I wish the user to view. If I'm on action 2 then the pano number will be 3. If I'm on action 3 then the pano number will be 4 and so on. It does work but I can't get the oninterrupt(break) to work at all. *confused* It's my understanding that oninterrupt(break) will stop the delayed call from executing.

    FIRST IMAGE XML

    <krpano version="1.0.8" onstart= "action(1);oninterrupt(break);delayedcall(time value,action(pano number, null, MERGE, BLEND(2)));">

    REMAINING IMAGE XML's

    <krpano version="1.0.8" onstart= "oninterrupt(break);delayedcall(time value,action(pano number, null, MERGE, BLEND(2)));">

    I'm happy with a virtual tour that will change scenes every 30-40 seconds and will stop the auto tour by simply interrupting the process. Starting it again by clicking a different thumb or hotspot is fine for me. The one issue I have for now is that the oninterrupt(break) function will not work. Any ideas? Simple is good PLEASE.

    Best Regards,

    Ben *confused*

  • Michael,

    Hey I've looked at that post and applied the code to my viewer. It plays but still doesn't stop. I think the problem is how I'm trying to apply the onclick event. Basically I copied the code for the onclick event from Klaus' post since I have no idea how to deal with this! Each pano scene starts with the following code. Each scene calls the next that follows. Here's what I have now. Any suggestions? *smile*

    <krpano version="1.0.8" onstart="action(1);set(delayedcall stop,false);delayedcall(40,if(delayedcall stop == false,action(2, null,MERGE,BLEND(2))));">

    <events onclick="set(delayedcallstop,true);" />

    Best Regards,

    Ben

  • I can attest that the notion is complete nonsense. So now that I've looked at what I was doing closer I know what I did wrong. I guess that there is no balance between learning code and a full steam ahead photo assignment. It isn't a good idea. NOW the panos are set to auto tour by default or until stopped by the camera controls and perhaps a button. I do pledge to study the actions/arguements tutorial.

  • Hi,

    I want to do the same, one round and then place the next xml. I tried to understand the code, but I can't.

    I have four XML files, virtualtour.xml, virtualtour0.xml (first scene), virtualtour1.xml (second scene), virtualtour2.xml (third scene), which code I add in each xml file?

    Thanks!

    Einmal editiert, zuletzt von YDM (19. Juni 2013 um 12:51)

  • Here's a quick version, incase you just want to rotate through all of your scenes.
    This displays each scene for 30 seconds, then moves on to the next.

    Add this action:

    Call the action on startup:

    Code
    <krpano version="1.0.8.14" onstart="rotateImages();">

    And if you want to autorotate each scene, add this:

    Code
    <autorotate enabled="true"
                waittime="1.0" 
                accel="2" 
                speed="8" 
                horizon="4" 
                tofov="120" 
                />

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!