You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, June 10th 2010, 3:52pm

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

2

Thursday, June 10th 2010, 9:07pm

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

3

Friday, June 11th 2010, 5:01pm

Let me repeat that....

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>

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

4

Monday, June 14th 2010, 6:27pm

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).

Quoted


<krpano version="1.0.8" onstart="action(thestart)">

<action name="thestart" >
set(autopre,0);
loadscene(scene1, null, MERGE, BLEND(1));
</action>

<!--Action that load next scene in accordance to the sceneNo -->
<action name="next-scene">
oninterrupt(break);
if(sceneNo == 1, loadscene(scene9, null, MERGE, BLEND(1)); );
if(sceneNo == 9, loadscene(scene30, null, MERGE, BLEND(1)); );
<!-- and so on -->
</action>

<!--Example of onstart's action that you put in the scenes -->
<action name="scene9-start">
set(sceneNo,9);
if(autopre == 1,delayedcall(60,next-scene()));
</action>

<!--action that starts / stops autopresentation -->
<action name="startstop-autopre">
if(autopre == 0,
set(autopre,1);
set(plugin[auto-button].url,"autopre-stop.png");
,
set(autopre,0);
set(plugin[auto-button].url,"autopre-start.png");
);
loadscene(sc%get(sceneNo), null, MERGE, BLEND(1));
</action>

<!--Plugin that raised start / stop autopresentation action -->
<plugin
name="auto-button"
url="autopre-start.png"
onclick="action(startstop-autopre)"
/>





I hope you understand now. ;-)

Regards
Greg

5

Wednesday, June 16th 2010, 5:17am

Damn...

What can I say Greg? Thanks. I will be looking this over for awhile before I really understand it! Thanks again.

Ben

6

Wednesday, June 16th 2010, 11:29pm

Okay the basic auto tour is running. Next step.

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*

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

7

Thursday, June 17th 2010, 8:11am

Hi Ben,

Quoted

It's my understanding that oninterrupt(break) will stop the delayed call from executing.
No... A delayedcall() starts a timer that can not be stopped... But Klaus gave a solution to check a variable before executing the actions called by the delayedcall... Have a look here: There is a mode to remove/stop a Delayedcall?

SAlut.

8

Thursday, June 17th 2010, 2:53pm

Thanks I'll check it out...

Michel,

Thanks. I'll check it out.

Ben

9

Friday, June 18th 2010, 1:29am

So how do I use the event for onclick to kill the delayed call?

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

10

Saturday, June 19th 2010, 2:03am

Some say ignorance is bliss....

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.

11

Wednesday, June 19th 2013, 11:18am

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!

This post has been edited 1 times, last edit by "YDM" (Jun 19th 2013, 12:51pm)


Posts: 9

Location: Israel

Occupation: interactive imaging

  • Send private message

12

Saturday, March 21st 2015, 9:43pm

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:

Source code

1
2
3
4
5
6
7
8
9
10
11
	<action name="rotateImages">
		if(%1 != NEXT, set(i,0));
		if(i >= scene.count, set(i,0));
		
		if(i LT scene.count,
			loadscene(get(i), null, MERGE, BLEND(1)); 
			wait(30);
			inc(i);
			rotateImages(NEXT);
		  );
	</action>


Call the action on startup:

Source code

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


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

Source code

1
2
3
4
5
6
7
<autorotate enabled="true"
            waittime="1.0" 
            accel="2" 
            speed="8" 
            horizon="4" 
            tofov="120" 
            />