Sie sind nicht angemeldet.

Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

1

Sonntag, 4. Juni 2017, 05:21

Multiple variable tween not working for me

The following code works as expected:

Quellcode

1
2
tween(hotspot[cover].ox, -200, 2, easeInOutQuad); 
tween(hotspot[cover].scale, get(new_scale), 2, easeInOutQuad);

but when combining the variables and values using the "|" operator like below the tween fails and the hotspot immediately disappears:

Quellcode

1
tween(hotspot[cover].scale|hotspot[cover].ox, get(new_scale)|-200, 2, easeInOutQuad);

What am I doing wrong?

(This is using v1.19.r8)

2

Sonntag, 4. Juni 2017, 10:07

hm, maybe this is not working :
get(new_scale)|-200

i would try:
tween(hotspot[cover].scale|hotspot[cover].ox, calc(new_scale+'|-200'), 2, easeInOutQuad);

or use txtadd before calling tween() to join the values
txtadd(tweento_values, new_scale, '|', -200);
tween(hotspot[cover].scale|hotspot[cover].ox, get(tweento_values), 2, easeInOutQuad);

Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

3

Montag, 5. Juni 2017, 05:12

calc(new_scale+'|-200')

Thanks for the suggestion but I don't think that is how it works. As background, from the docs:

Zitat

Multiple variable support: It is possible to tween several variables together at once. Therefore specify several variables, values and tweentypes separated by | characters.

variable:
Use the | character to specify several variables.

value
Use the | character to specify several values for several variables.
Note - to tween to the value of another variable use the get() action to get the value of the other variable!

BUT, your comment gave me an idea. Instead of using the get() action I substituted an absolute value. That worked. So

Klaus, I believe we have a bug. Using a get() in a multiple variable tween causes the tween to fail.

4

Montag, 5. Juni 2017, 07:27

did you test if your variable is really ok?
ie. trace(new_scale); before you call tween() to see if it s not null or smth.

Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

5

Montag, 5. Juni 2017, 08:28

did you test if your variable is really ok?

Certainly. And notice, it works fine when the two tweens are executed separately. It is only when they are combined that it fails.

6

Montag, 5. Juni 2017, 09:55


Certainly. And notice, it works fine when the two tweens are executed separately. It is only when they are combined that it fails.


ok... from how i understand get() i think, too, that it should work. lets see what stefan says.
i personally always constructed the value first with txtadd.... this should work, but is an extra step ofc.


ps if you're in the mood of testing you could try this:
set(variable,50);
testaction(get(variable)|-200);
then in testaction: trace(%1); and maybe trace("%1");

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »indexofrefraction« (5. Juni 2017, 10:17)


Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

7

Montag, 5. Juni 2017, 20:46

ps if you're in the mood of testing you could try this:
set(variable,50);
testaction(get(variable)|-200);
then in testaction: trace(%1); and maybe trace("%1");

Not sure where this was going but tried it anyway. %1 and "%1" resolve to: get(variable)|-200

Now, if you use a comma instead of a pipe: testaction(get(variable),-200);, %1 resolves to: 50 which is expected.

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

8

Dienstag, 6. Juni 2017, 09:01

Hi guys!

I also bumped into this issue some time ago, here's the thread: https://krpano.com/forum/wbb/index.php?p…ables#post69122
Regards,

Alexey

9

Dienstag, 6. Juni 2017, 10:38

ps if you're in the mood of testing you could try this:
set(variable,50);
testaction(get(variable)|-200);
then in testaction: trace(%1); and maybe trace("%1");

Not sure where this was going but tried it anyway. %1 and "%1" resolve to: get(variable)|-200

Now, if you use a comma instead of a pipe: testaction(get(variable),-200);, %1 resolves to: 50 which is expected.



that is what i thought :
get(variable)|-200 is resolved as a complete string and get() does not get parsed in this case...
dunno if this is a bug or intended, but i guess the latter. this only klaus can tell.

just circumvent this by constructing one variable for the tween function first, as i posted before :

txtadd(tweento, get(var1), '|', get(var2), '|', get(var3));
tween(prop1|prop2|prop3,get(tweento),0.5);


or... darn, i should read first before writing :D
... use calc() like in Alexey's thread !

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »indexofrefraction« (6. Juni 2017, 11:00)


10

Dienstag, 6. Juni 2017, 14:56

Hi,
dunno if this is a bug or intended, but i guess the latter. this only klaus can tell.
That works as intended, the special get() and calc() functions are resolving the given parameters/values before passing them to the action, but they work only on the whole parameter.

E.g.

Quellcode

1
actionname( get(...anything...), calc(...anything...) );


So the correct solution for:

Quellcode

1
tween(hotspot[cover].scale|hotspot[cover].ox, get(new_scale)|-200, 2, easeInOutQuad);


would be e.g. this one:

Quellcode

1
tween(hotspot[cover].scale|hotspot[cover].ox, calc(new_scale + '|-200'), 2, easeInOutQuad);


The calc function first automatically resolves 'new_scale' to its value and than adds the string '|-200' and then passes that to the tween action.

Best regards,
Klaus

Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

11

Dienstag, 6. Juni 2017, 19:57

would be e.g. this one:

Quellcode

1
tween(hotspot[cover].scale|hotspot[cover].ox, calc(new_scale + '|-200'), 2, easeInOutQuad);


The calc function first automatically resolves 'new_scale' to its value and than adds the string '|-200' and then passes that to the tween action.


Yup. That works. Don't think I ever would have figured that out myself. On the bright side, I now have a little better understanding of the calc action.

Thanks, Klaus (and Alexey).

12

Dienstag, 6. Juni 2017, 20:56

actually i told you to use calc() in my first answer *tongue* *whistling*