Sie sind nicht angemeldet.

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

1

Montag, 20. Oktober 2014, 11:59

What is correct syntax for tweening two variables simultaneously?

Hi!

i'm now studying the latest cool (God bless it!) Krpano release and find it FABULOUS!))

Just try to understand how to tween, say, width and height of a container layer using the new tween(); Which is correct:

this?

Quellcode

1
tween(width,300,2|height,200,2);


or this?

Quellcode

1
tween(width|height, 300|200, 2);


In both cases width and height are tweened to the needed values but they "jump" (seems default 0.5 time is used). But how to set the correct time for the tween?

Thanks!
Regards,

Alexey

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

2

Montag, 20. Oktober 2014, 12:04

OOpppss) I found the right way:

Quellcode

1
tween(width,300,2|height,200,2);
Regards,

Alexey

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

3

Montag, 20. Oktober 2014, 12:08

I continue playing around and when the container layer initially has percent values as width and height, and if I tween width/height to som smaller pixel values, the layer first jumps to some very small width/height and then expands to the target values. Take a look:

http://vt.most-inform.com/18/

the code is here:

http://vt.most-inform.com/18/skin/vtourskin.xml
Regards,

Alexey

4

Montag, 20. Oktober 2014, 12:09

Hi,

the second example is the correct one:

Quellcode

1
tween(width|height, 300|200, 2);


This should tween width to 300 and height to 200 in 2 seconds.

There should be no 'jumps' in normal cases.

The only case when there could be a 'jump' would be when mixing absolute values and percent values - the tween action itself can't resolve percent values to their absolute value (because it doesn't know a percent of what) - so when the value first was a percent value and then there is a absolute value to tween to, then there can be a jump at the start of the tween.

Best regards,
Klaus

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

5

Montag, 20. Oktober 2014, 12:11

Seems that original "jumping" was due to percent width/height values that's why I couldn't get tween working properly and thought that the syntax was incorrect *smile* .
Regards,

Alexey

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

6

Montag, 20. Oktober 2014, 12:12

Ok, thanks) now I understand it)
Regards,

Alexey

7

Montag, 20. Oktober 2014, 12:14

It seems were posting at the same time
When I sent my answer there was only the first post.

Yes - the initial percent values are the problem here.

In this case do:

Quellcode

1
copy(width,pixelwidth); copy(height,pixelheight); tween(...);

To get the absolute pixel sizes first before doing the tween.

Edit:
Normal the code above should already enough, but in this case that code will be called before the element was draw at least once, the updatepos() action should be additionally called to make sure that the pixelwidth and pixelheight values are calculated correctly:

Quellcode

1
updatepos(); copy(width,pixelwidth); copy(height,pixelheight); tween(...);


Best regards,
Klaus

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

8

Montag, 20. Oktober 2014, 12:18

Ahah) fast-testing and reporting from me))) sorry))

Yes, I thought about copying pixelwidth and then tweening. Cool feature!!!
Regards,

Alexey