You are not logged in.

gabriel

Beginner

  • "gabriel" started this thread

Posts: 28

Location: Paris, France

Occupation: photographer

  • Send private message

1

Sunday, January 3rd 2016, 7:59pm

How can i loop this, without using loop() ?

I all,

here is my tour :
http://www.gabrielacoca.fr/egin

and, as you see, hotspots tweens with differents delayedcalls
i want to loop this action.

This action is call via the first hotspot :

Source code

1
onloaded="action1"



then action1 is working, and at the end :

Source code

1
2
delayedcall(82,tween(hotspot[hotspot21].alpha,0,2););
delayedcall(84,action1(););


but this don't work *cry*

A other thing that is that the quality of the image decrease with the time: at the beginning it's ok, but when the action starts, the image is "blurry". Maybe it's because there is a fade , but all the images are made from the same point, using a trigger, so normally, it doesn't move.


Thank you and have a nice year.


Gabriel.

panomaster

Intermediate

Posts: 297

Location: Kobyłka, Poland

Occupation: Virtual Tours - Spherical Panoramas - Krpano developer

  • Send private message

2

Sunday, January 3rd 2016, 11:52pm

You shouldn't use delayedcall for counters, creating animations etc. Even if you can stop specific delayedcall (using name) you almost have no control on these functions - eg. you cannot check if any delayedcall function was "in progress".

Action1 is not a good action - delayedcall functions are not triggered sequentially - in fact you triger 50 delayed calls at the same time, then you want to loop it. It's hard to control it.

Here's the better way:

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
<action name="frame1">
	tween(hotspot[hotspot1].alpha,0,1);
	tween(hotspot[hotspot2].alpha,1,1);
	delayedcall(nextframe, 1, frame2());
</action>

<action name="frame2">
	tween(hotspot[hotspot2].alpha,0,1);
	tween(hotspot[hotspot3].alpha,1,1);
	delayedcall(nextframe, 1, frame3());
</action>

<action name="frame3">
	tween(hotspot[hotspot3].alpha,0,1);
	tween(hotspot[hotspot4].alpha,1,1);
	delayedcall(nextframe, 1, frame4());
</action>

<action name="frame4">
	tween(hotspot[hotspot4].alpha,0,1);
	tween(hotspot[hotspot1].alpha,1,1);
	delayedcall(nextframe, 1, frame1());
</action>


Such created actions give you 2 advantages:

1. you can start hotspot animation with any frame (not the first one)
2. you can stop animation anytime using

Source code

1
stopdelayedcall(nextframe);


Of course you can do it even better using self triggered action with counter, but try to do it in the way I wrote above.

gabriel

Beginner

  • "gabriel" started this thread

Posts: 28

Location: Paris, France

Occupation: photographer

  • Send private message

3

Monday, January 4th 2016, 2:20am

Thank you Panomaster for the time you take and for the lesson you give me.

Your code is simple, effective, and ... logical !

i learn 3 things with your answer :

-it's possible to tell "nextframe"
-use less images than 22 !
-try to be simple as possible

Thanks again and have a nice day.

Gabriel.

Similar threads