You are not logged in.

1

Wednesday, November 16th 2011, 11:47am

hotspot animation start / stop

Hi

i would like animation start boutton and animation stop boutton

if i click on plugin animation start but if click bstart button , not work

help please


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
	<plugin name="move"   style="v1"
	
				 onclick="action(hotspot_animate)"
		     	/>
				 	
		<hotspot name="btstart"   
		     	ath="0" atv="0"
				 url="b1.png"
		   	
				 onclick="action(hotspot_animate)"
		     	/>  	 	
				 
		<hotspot name="btstop"   
		     	ath="10" atv="10"
				 url="b2.png"
		    	
				 onclick="breakall(hotspot_animate)"
		     	/>		 
			 	
	<style name="v1"
	   	url="hotspots/anime.png"
	   	crop="0|0|161|68"
	   	framewidth="161" frameheight="68" frame="0" lastframe="7"
	   	/>

	<action name="hotspot_animate">
		inc(frame,1,get(lastframe),0);
		mul(ypos,frame,frameheight);
		txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));
		delayedcall(0.1, hotspot_animate() );
	</action>
	

2

Thursday, November 17th 2011, 3:58pm

Hi,

the 'hotspot_animate' action loops itself by call itself by a delayedcall,
see here:

Source code

1
delayedcall(0.1, hotspot_animate() );


to be able to stop that process you can define an additionally custom variable and check for this variable before doing the delayedcall,

e.g.

Source code

1
if(anistopped == false, delayedcall(0.1, hotspot_animate() );)


and add - anistopped="false" - to the <plugin> definition of the hotspot,

for stopping the animation just set:

Source code

1
set(hotspot[spotname].anistopped,true);


when it should be started again - from an action from another hotspot or plugin element, then the 'hotspot_animate' needs first to be rewritten to use 'absolute variable paths',
e.g.

Source code

1
2
3
4
5
6
<action name="hotspot_animate">
inc(hotspot[%1].frame,1,get(hotspot[%1].lastframe),0);
mul(ypos,hotspot[%1].frame,hotspot[%1].frameheight);
txtadd(hotspot[%1].crop,'0|',get(ypos),'|',get(hotspot[%1].framewidth),'|',get(hotspot[%1].frameheight));
delayedcall(0.1, hotspot_animate(%1) );
</action>


and then the 'hotspot_animate' action must be called with the name of the hotspot that should be animated,
e.g.
to start the animation:

Source code

1
2
set(hotspot[spotname].anistopped, false);
hotspot_animate(spotname);


best regards,
Klaus

3

Monday, December 21st 2015, 6:52pm

Animation stoped

Hello! How can you stop the animation of one button? Here is my code:

Source code

1
2
3
<style name="gerlstyle"	 url="sex25.png"	 crop="0|0|500|500"	 framewidth="500"  frameheight="500" frame="0" lastframe="25"		      	       />
 <action name="gerl_play" > inc(frame,1,get(lastframe),0);	 mul(ypos,frame,frameheight);	 txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));	 delayedcall(0.06, if(loaded, gerl_play() ) );	 </action>	 <action name="gerl_stop"> stopall();	</action>	
<hotspot name="gerl_hotspot"  style="gerlstyle"  ath="-3.65074"  atv="1.586068"  width="400" height="400"  distorted="true"	 visible="true"  stopspotsequence="false"	onclick="    if (gerl_hotspot!= 1,    set(gerl_hotspot,1);gerl_play(); ,    set(gerl_hotspot,0);gerl_stop(););"/>

everything works, but when "stopall();", stop all the other action ... how to stop only the desired hotspot?

4

Wednesday, December 23rd 2015, 8:50am

Hi,

either use a 'named' delayedcall (that means adding an unique name/id as first parameter) and than call stopdelayedcall() with that name/id,

see:
http://krpano.com/docu/actions/#delayedcall
http://krpano.com/docu/actions/#stopdelayedcall

or use as in the example above a custom property ('anistopped') for stopping the animation.

Best regards,
Klaus

5

Wednesday, December 23rd 2015, 12:45pm

either use a 'named' delayedcall (that means adding an unique name/id as first parameter) and than call stopdelayedcall() with that name/id,
Thank you! Everything worked out! Here is my code:

Source code

1
	<action name="gerl_play" >		inc(frame,1,get(lastframe),0);		mul(ypos,frame,frameheight);		txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));		delayedcall(introimage, 0.06, gerl_play() );		        	</action>		<action name="gerl_stop">			stopdelayedcall(introimage);	</action>

6

Sunday, December 27th 2015, 12:50pm

reverse animation

Hello! how to make an animation in the opposite direction? not from 0 to 16, but vice versa (16,15,14,13 ......). Here is my code:

Source code

1
<action name="crok_play" >inc(frame,1,get(lastframe),0);mul(ypos,frame,frameheight);txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));delayedcall(crokimage, 0.1, crok_play() ); </action>