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.

  • "Kev-in-spain" started this thread

Posts: 110

Location: Barcelona

Occupation: VR Photographer

  • Send private message

1

Friday, September 9th 2011, 9:03pm

animated plugin

I'm trying to create a plugin which will animate onover and return to frame 1 onout. Also, the animation must only run once i.e. frames 1 to 40 and stop.
I can do this by using the standard krpano animate code and changing the 0 for 39 as follows:

<action name="animate">
inc(frame,1,get(frames),39);
mul(ypos,frame,frameheight);
txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));
delayedcall(0.06, animate() );
</action>
My problem is, I don't know how to get it to return to frame 1 onout so that it is ready for the next mouseover action.

Any ideas anyone?

Thanks

Kev.

sachagriffin

Professional

Posts: 1,502

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Friday, September 9th 2011, 9:44pm

your minimum frame is 39?
frames is unknown

onout"set(frame,1);"

I think your inc max and min are mixed up and don't even make sense if you don't want it to repeat.. the documentation says it loops using that.
inc(variable,byvalue*,max*,min*)
dec(variable,byvalue*,min*,max*)

<action name="animate">
ifnot (frame == 40,inc(frame,1));
mul(ypos,frame,frameheight);
txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));
delayedcall(0.06, animate() );
</action>
KRPano Developer: Portfolio :: Facebook :: Twitter :: r/VirtualTour

  • "Kev-in-spain" started this thread

Posts: 110

Location: Barcelona

Occupation: VR Photographer

  • Send private message

3

Monday, September 12th 2011, 5:17am

Thanks Sacha,

As you can tell, I'm learning by trial and error and don't have as much understanding of xml code as I would like. I found (by trial and error) that by changing the 0 to 39 (my number of frames) I got the effect I was looking for.
The corrected code that you gave me also works however, the onout"set(frame,1);" is not working for me. Yes, it sets the plugin back to frame 1 but it immediately runs through the animate action again.
What I need is for it to set to frame 1 so that it is ready to animate again onover.

Kev

sachagriffin

Professional

Posts: 1,502

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

4

Monday, September 12th 2011, 6:05am

<action name="animate">
ifnot (delaykilled ==true,
ifnot (frame == 40,inc(frame,1));
mul(ypos,frame,frameheight);
txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));
delayedcall(0.06, animate() );
);
</action>


onout"set(frame,1);set(delaykilled,true)"

and before you animate();
set(delaykilled,false);animate();

Nothing really xml code here.. its just basic programming. My way is straightforward logic. I'm sure there is a cleverer method.
Try reading some programming tutorials online and try to stop trial and error in favor of very slow understanding of what you are trying to achieve and think it through step by step. That's the only way to learn. I rebelled against learning to programming anything until about 6 years ago.. It was a futile effort.
KRPano Developer: Portfolio :: Facebook :: Twitter :: r/VirtualTour

sachagriffin

Professional

Posts: 1,502

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

5

Monday, September 12th 2011, 6:15am

go back to your animate action and
onout="breakall();mul(ypos,1,frameheight);txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));"

would be even better since it would stop the running action, and reset the frame at the same time.
Unless you have other actions running, then you have to go back to killing the action personally like I did before.

<action name="animate">
ifnot (frame == 40,inc(frame,1));
mul(ypos,frame,frameheight);
txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));
delayedcall(0.06, animate() );
</action>
KRPano Developer: Portfolio :: Facebook :: Twitter :: r/VirtualTour