You are not logged in.

1

Tuesday, March 24th 2015, 12:53pm

Combining tweens (in parallel)

Is it possible to have two tween actions occur simultaneously?

I want to have the visual effect of a new hotspot 'dropping' into the KRPano image by combining scale and alpha. The following code would ideally add a hotspot and then animate it 'down' onto the KRPano:

Source code

1
2
3
4
5
6
7
// initial setup
addhotspot(h);
set(hotspot[h].scale, 10);
set(hotspot[h].alpha, 0.3);
// now animate
tween(hotspot[h].scale, 1, 0.5);
tween(hotspot[h].alpha, 1, 0.5);


..but the last two lines, of course, are executed in serial. i.e. the hotspot first reduces in size and *then* becomes opaque.

Can this be done?

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

2

Wednesday, March 25th 2015, 2:42pm

Hi)

Read documentation more carefully, it's possible to tween several variables inside one "tween" acrion:

http://krpano.com/docu/actions/#tween

Check also this thread:

What is correct syntax for tweening two variables simultaneously?
Regards,

Alexey

3

Wednesday, March 25th 2015, 3:03pm

Hi,

Quoted

..but the last two lines, of course, are executed in serial.
The tween actions in your code will NOT be executed in serial.

The tween() call only starts the execution but then it will run parallel.

For serial sequences the 'donecall' of the tween would need to be used.


Multiple-variable tweens could be used too, but the result will be the same as the two tween calls - e.g.

Source code

1
tween(hotspot[h].scale|hotspot[h].alpha, 1.0|1.0, 0.5);

or

Source code

1
callwith(hotspot[h], tween(scale|alpha, 1.0|1.0, 0.5) );


Best regards,
Klaus

4

Thursday, April 2nd 2015, 9:40am

Doh! Sorry, I have no idea how I completely missed that sub-section of the tween documentation.

I have it working now - thanks for replying and apologies for wasting your time by not RTFMing.

Cheers
Martin

Similar threads