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.

booghy08

Beginner

  • "booghy08" started this thread

Posts: 37

Location: Romania

Occupation: Virtual Tours

  • Send private message

1

Friday, September 24th 2010, 11:18pm

oninterrput not working

Hallo, i've created here an self rotating and changing tour. the problem is that if i try to use user interaction to stop the actions , it doesn't interrupt the actions

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<plugin name="360spiner_data"
		currentpano="0"
		spin_turn_on="1"
		keep="true"
		>
</plugin>		

<action name="loadpanos">
set(spiner,0);
trace(spiner);
oninterrupt(break);
  if(plugin[360spiner_data].currentpano == 1,                                            check_view();tween(););
  if(plugin[360spiner_data].currentpano == 2,load(2.xml, null, MERGE, ZOOMBLEND(1.5,10));check_view();tween();
  if(plugin[360spiner_data].currentpano == 3,load(3.xml, null, MERGE, ZOOMBLEND(1.5,10));check_view();tween(;);
  if(plugin[360spiner_data].currentpano == 4,load(4.xml, null, MERGE, ZOOMBLEND(1.5,10));check_view();tween(;);
  if(plugin[360spiner_data].currentpano == 5,load(5.xml, null, MERGE, ZOOMBLEND(1.5,10));check_view();tween(););
  if(plugin[360spiner_data].currentpano == 6,load(6.xml, null, MERGE, ZOOMBLEND(1.5,10));check_view();tween(););
  if(plugin[360spiner_data].currentpano == 7,load(7.xml, null, MERGE, ZOOMBLEND(1.5,10));check_view();tween(););
  if(plugin[360spiner_data].currentpano == 8,load(8.xml, null, MERGE, ZOOMBLEND(1.5,10));check_view();tween(;);

  </action>

<action name="check_view">
this action creates 360 spin
</action>

www.360concept.ro

2

Friday, September 24th 2010, 11:35pm

Try putting it above the set(spinner,0); or just below it but above trace(spinner);

It needs to be put before the action you want to interrupt.

booghy08

Beginner

  • "booghy08" started this thread

Posts: 37

Location: Romania

Occupation: Virtual Tours

  • Send private message

3

Saturday, September 25th 2010, 11:26am

i tried to put it before tween , before the action check_value ,before trace or before set, it doesn't stop to autorotation. The action that i want to stop is the tween from the if statemant

4

Saturday, September 25th 2010, 11:49am

Try with stopall or breakall
but if is only for the autorotation put it on false

Source code

1
set(autorotate.enable, false);

booghy08

Beginner

  • "booghy08" started this thread

Posts: 37

Location: Romania

Occupation: Virtual Tours

  • Send private message

5

Saturday, September 25th 2010, 12:01pm

This is a stripped part of the code.as u can see it has only on action with one tween. all i need is to stop that tween on user click ,or movement.i've tested breakall, stopall or stop.Nothing works

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<krpano version="1.0.8" onstart="onstarttur()">
	<view hlookat="0" vlookat="0"  />
	<image type="CUBE" multires="true" tilesize="955">
		<level tiledimagewidth="1910" tiledimageheight="1910">
			<left  url="pano/afara/1/l_%0v_%0h.jpg" />
			<front url="pano/afara/1/f_%0v_%0h.jpg" />
			<right url="pano/afara/1/r_%0v_%0h.jpg" />
			<back  url="pano/afara/1/b_%0v_%0h.jpg" />
			<up    url="pano/afara/1/u_%0v_%0h.jpg" />
			<down  url="pano/afara/1/d_%0v_%0h.jpg" />
		</level>
	</image>

	<action name="onstarttur">
		
oninterrupt(break);tween(view.hlookat,360, 15.0, easeInOutSine);
oninterrupt(break);
	</action>
</krpano>

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

6

Saturday, September 25th 2010, 6:46pm

Hi booghy08,

A tween could not be stopped in using break... You should use stopall() , breakall() or stoptween(var)... See here...
Also, it seems that the call of your action onstarttur() from onstart makes the oninterrupt() action to not works properly... Do not know why....
edited: after more tries it seems that the above was something on the code I used to test, that causes a problem...
Try to delayedcall() your action:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<krpano version="1.0.8" onstart="delayedcall(4,onstarttur())">
<view hlookat="0" vlookat="0"  />
<image type="CUBE" multires="true" tilesize="955">
<level tiledimagewidth="1910" tiledimageheight="1910">
<left  url="pano/afara/1/l_%0v_%0h.jpg" />
<front url="pano/afara/1/f_%0v_%0h.jpg" />
<right url="pano/afara/1/r_%0v_%0h.jpg" />
<back  url="pano/afara/1/b_%0v_%0h.jpg" />
<upurl="pano/afara/1/u_%0v_%0h.jpg" />
<down  url="pano/afara/1/d_%0v_%0h.jpg" />
</level>
</image>

<action name="onstarttur">
oninterrupt(stopall());
tween(view.hlookat,360, 15.0, easeInOutSine);
</action>
</krpano>

Doing in this way it works...
Or call your action from an event like onxmlcomplete or onloadcomplete...

SAlut.

This post has been edited 1 times, last edit by "michel" (Sep 25th 2010, 7:09pm)


booghy08

Beginner

  • "booghy08" started this thread

Posts: 37

Location: Romania

Occupation: Virtual Tours

  • Send private message

7

Sunday, September 26th 2010, 2:43pm

Hi michael,
i've tried your ideas but neighter or them worked , the tween doesn't stop.I've tried a hack by comparing the movement of the mouse with the events onmousedown and onmouseup.
if someone knows how to make oninterrupt work on the krpano version 1.0.8.11, i'll wait for your reply.

8

Sunday, September 26th 2010, 3:59pm

Maybe this discussion can help. Klaus mentioned a stop tween function. Don't really know if it has been implemented.


http://www.krpano.com/forum/wbb/index.ph…+tween#post1275

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

9

Sunday, September 26th 2010, 6:45pm

Hi booghy08,

I think all the problem come from how oninterrupt() works:
oninterrupt(newaction)
- this function can be set before starting a lot of action calls
- it was called when a mouse click interrupts one of following actions
- after interrupting or processing all actions, this function will be disabled until next call
....
On your example,the last action is the tween itself... So, the oninterrupt() action becomes disabled ....
Then, for this example, a possible working code could be adding a WAIT argument to the tween... Like this:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<krpano version="1.0.8" onstart="onstarttur()">
	<view hlookat="0" vlookat="0"  />
	<image type="CUBE" multires="true" tilesize="955">
		<level tiledimagewidth="1910" tiledimageheight="1910">
			<left  url="pano/afara/1/l_%0v_%0h.jpg" />
			<front url="pano/afara/1/f_%0v_%0h.jpg" />
			<right url="pano/afara/1/r_%0v_%0h.jpg" />
			<back  url="pano/afara/1/b_%0v_%0h.jpg" />
			<up	url="pano/afara/1/u_%0v_%0h.jpg" />
			<down  url="pano/afara/1/d_%0v_%0h.jpg" />
		</level>
	</image>
	
	<action name="onstarttur">
		oninterrupt(stopall()); <!-- OR: -- oninterrupt(stoptween(view.hlookat));  -->
		tween(view.hlookat,360, 15.0, easeInOutSine,WAIT);
	</action>
</krpano>


Hope this help...

SAlut.

10

Monday, September 27th 2010, 4:28pm

Hi,

right, oninterrupt works only with functions/actions that are blocking the user interface,
that are only the lookto/moveto/zoomto/wait and the tween(..., WAIT) actions,

and when it was called, then all actions that were left it the actions queue (thats are all actions that are after the current executing action) were removed, and also the oninterrupt itself is also cleared,

normal tweens (without WAIT) are something different, they are running independtly of the normal actions,
they will not be touched in anyway by the oninterrupt() usage,

normal tweens can only be stopped by the stoptween() action,

so, the solution from michel is already a right one

alternatively you could use the lookto() action, this is also a 'blocking' action (like the tween with WAIT),
both can be interrupted,
e.g.

Source code

1
2
3
4
<action name="onstarttur">
  oninterrupt(break);
  lookto(360,get(view.vlookat),get(view.fov), smooth(2,2,24), false);
</action>


best regards,
Klaus

booghy08

Beginner

  • "booghy08" started this thread

Posts: 37

Location: Romania

Occupation: Virtual Tours

  • Send private message

11

Monday, September 27th 2010, 7:41pm

my solution for the problem. but there is just a small bug that i can't solve. if i stop the pano twice from moving in a short interval, it call twice the delayedcall(2,if(delayedcallkilled == true,loadpanos(noload))); , and i only want to do it once.

the way the code works:
spiner= if u have hlookat set at -20 it will spin until -340 or -380 (from left or right);
check_view= sets the spiner
init_view = it stores the initial view point , so when u stop the pano it doesnt calculate from the last view point
var_current_pano= the pano id ;
noload(from the loadpanos action)= this one i'll let u figure it out :P

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<events onmousedown="mouse_down()" onmouseup="mouse_up()" />

	<action name="mouse_down">
		copy(mx, mouse.x);
		copy(my, mouse.y);
	</action>

	<action name="mouse_up">
		sub(v, mouse.x, mx);
		if (v LT 0, mul(v, -1));
		if (v GT 20, 
			set(mouse_moved, true);
		,
			sub(v, mouse.y, my);
			if (v LT 0, mul(v, -1));
			if (v GT 20, 
				set(mouse_moved, true);
			,
				set(mouse_moved, false);
			);
		);
		if (mouse_moved,
		
		delayedcall(2,if(delayedcallkilled == true,loadpanos(noload)));
		stopall();
			
		);
	</action>

<action name="loadpanos">
set(spiner,0);
trace(get(var_current_pano)); 
  if(var_current_pano == 1,
						if(%1 == noload,check_view(right);tween(view.hlookat,get(spiner), 5.0, easeInOutSine,set(var_current_pano,2);loadpanos(););,
						load(1.xml, null, MERGE, ZOOMBLEND(1.5,10));wait(blend);set(init_view,get(view.hlookat));check_view(right);tween(view.hlookat,get(spiner), 1.0, easeInOutSine,set(var_current_pano,2);loadpanos(););));

  if(var_current_pano == 2,
						if(%1 == noload,check_view(right);tween(view.hlookat,get(spiner), 1.0, easeInOutSine,set(var_current_pano,3);loadpanos(););,
						load(2.xml, null, MERGE, ZOOMBLEND(1.5,10));wait(blend);set(init_view,get(view.hlookat));check_view(right);tween(view.hlookat,get(spiner), 1.0, easeInOutSine,set(var_current_pano,3);loadpanos(););));
	 if(var_current_pano == 3,
						if(%1 == noload,check_view(right);tween(view.hlookat,get(spiner), 1.0, easeInOutSine,set(var_current_pano,4);loadpanos(););,
						load(3.xml, null, MERGE, ZOOMBLEND(1.5,10));wait(blend);set(init_view,get(view.hlookat));check_view(right);tween(view.hlookat,get(spiner), 1.0, easeInOutSine,set(var_current_pano,4);loadpanos(););));
  if(var_current_pano == 4,
						if(%1 == noload,check_view(right);tween(view.hlookat,get(spiner), 1.0, easeInOutSine,set(var_current_pano,5);loadpanos(););,
						load(4.xml, null, MERGE, ZOOMBLEND(1.5,10));wait(blend);set(init_view,get(view.hlookat));check_view(right);tween(view.hlookat,get(spiner), 1.0, easeInOutSine,set(var_current_pano,5);loadpanos(););));
  if(var_current_pano == 5,
						if(%1 == noload,check_view(right);tween(view.hlookat,get(spiner), 1.0, easeInOutSine,set(var_current_pano,1);loadpanos(););,
						load(5.xml, null, MERGE, ZOOMBLEND(1.5,10));set(init_view,get(view.hlookat));wait(blend);check_view(right);tween(view.hlookat,get(spiner), 1.0, easeInOutSine,set(var_current_pano,1);loadpanos(););));
 </action>

<action name="check_view">
if(%1==left,
	if(init_view GT -1,add(spiner,-360,init_view));
	if(init_view LT 0,add(spiner,-360,init_view)) );
if(%1==right,	
	if(init_view GT -1,add(spiner,360,init_view)) ;
	if(init_view LT 0,add(spiner,360,init_view)) );
</action>
	

JPC

Beginner

Posts: 40

Location: Paris

Occupation: Photographies and media

  • Send private message

12

Monday, August 22nd 2011, 4:22pm

pausetween

Hi


i would like to program the equivalent of a "pausetween"

i tested the autotour with oninterrupt(break) and the WAIT donecall, the stoptween without the WAIT donecall, precisely i would like to be abble to interrupt a tween(hlookat or vlookat and after on oniddle the tween finish the mouvement.

does somebody ever wrotte this code ?

maybe the solution could be in an autotour to incstep -1 on iddle but there is a conflict with the oniddle(setuptour) from the autotour.


thank you

Posts: 1,852

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

13

Monday, August 22nd 2011, 6:25pm

Just store the state of where you are in variables and after on idle pick back up from where you left off.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

JPC

Beginner

Posts: 40

Location: Paris

Occupation: Photographies and media

  • Send private message

14

Thursday, August 25th 2011, 1:19pm

pausetween

Thank you, the probleme is that i havent only one step in my autotour, so… i havent any simple solution that why i was looking for a"pausetween" or oninterrupt(pause) fonction.
Maybe there somethink i missed.

Posts: 1,852

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

15

Thursday, August 25th 2011, 3:31pm

Exactly, even if you have many steps, you can always store a variable of what step you are on and where you are and just continue where you left off. No need to hack the core player.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

JPC

Beginner

Posts: 40

Location: Paris

Occupation: Photographies and media

  • Send private message

16

Thursday, August 25th 2011, 8:41pm

ok how ?


for exemple


Source code

1
2
3
4
5
6
7
8
9
10
<action name="autotourintro">
oninterrupt(breakall());
if(stepintro == 3, tween(view.hlookat,180,20,easeInOutCubic);tween(view.Vlookat,0,20,easeInOutCubic);tween(view.fov,80,20,easeInOutCubic,WAIT);inc(stepintro); ); 
if(stepintro == 4, action(hotspotvideovisibletrue0);inc(stepintro); );
 if(stepintro == 5, loadpano(Jardindumuseeduquaibranly12.xml,NULL,NULL,BLEND(5));lookat(-110,-30,60);set(stepintro,6); );

if(stepintro == 14, tween(view.hlookat,295,35,easeInOutCubic);tween(view.Vlookat,0,35,easeInOutCubic);tween(view.fov,50,35,easeInOutCubic,WAIT);inc(stepintro); ); 
if(stepintro == 15, loadpano(Jardindumuseeduquaibranly3.xml,NULL,NULL,BLEND(5));lookat(250,55,30); set(stepintro,16); );

</action>

JPC

Beginner

Posts: 40

Location: Paris

Occupation: Photographies and media

  • Send private message

17

Thursday, August 25th 2011, 8:48pm

maybe like this

Source code

1
2
3
4
5
6
7
8
9
10
11
<action name="autotourintro">
oninterrupt(breakall());
i
f(stepintro == 3, oninterrupt(set(stepintro,3));tween(view.hlookat,180,20,easeInOutCubic);tween(view.Vlookat,0,20,easeInOutCubic);tween(view.fov,80,20,easeInOutCubic,WAIT);inc(stepintro); ); 
if(stepintro == 4, action(hotspotvideovisibletrue0);inc(stepintro); );
 if(stepintro == 5, loadpano(Jardindumuseeduquaibranly12.xml,NULL,NULL,BLEND(5));lookat(-110,-30,60);set(stepintro,6); );

if(stepintro == 14, tween(view.hlookat,295,35,easeInOutCubic);tween(view.Vlookat,0,35,easeInOutCubic);tween(view.fov,50,35,easeInOutCubic,WAIT);inc(stepintro); ); 
if(stepintro == 15, loadpano(Jardindumuseeduquaibranly3.xml,NULL,NULL,BLEND(5));lookat(250,55,30); set(stepintro,16); );

</action>

Posts: 1,852

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

18

Friday, August 26th 2011, 12:36am

That looks good. Does it work ok?
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

19

Friday, August 26th 2011, 9:43am

Hi JPC,

Have a look to this post from Klaus...

SAlut.

JPC

Beginner

Posts: 40

Location: Paris

Occupation: Photographies and media

  • Send private message

20

Friday, August 26th 2011, 1:56pm

Thank you sacha, thank you Michel, but it doesnt solve my problem, maybe can you have a look to my project,


http://www.camus.pro/jdqb/Jardindumuseeduquaibranly.html

Jean-Philippe