Math operators and animation: add + tween. UPD: stop delayedcall in action?

  • Math operators and animation: add + tween.
    Hello!
    Appeared task when you press the button or to define a action to make the move to a specific value hlookat/vlookat, for example on 10 horizontally and vertically in a spherical panorama.
    Regular animation TWEEN will look this:

    Code
    tween(view.hlookat,187.5,1.0); tween(view.vlookat,0.33,1.0);


    But we have to write every time precisely value of hlookat/vlookat, but it is not convenient or suited for use one action in the different panoramas with different values of the starting point of view.
    Is the operator ADD and you can use to them:

    Code
    add(view.hlookat,5); add(view.vlookat,5);


    There will be no movement on the transition, the values for hlookat / vlookat.
    I tried different ways to merge these two operators, but could not in single action.
    Tell me how to merge these two operators, or may need to use a different method and solution of the problem?

    Panoreal — to make and see this wonderful world! *whistling*

    Edited once, last by Arsdezi (August 12, 2012 at 5:30 PM).

  • It worked!
    But there was another problem *sad*
    I make the cursor movement with the rotation of the panorama tween+add (view.lookat) after a specified time(delayedcall)
    Now when you click at any time (and time of execution of actions) on the "stop" button I need to hide the cursor and stop the movement of the panorama (stop the action performed by delayedcall), then hide the button itself, "Stop."
    The cursor and the button are removed without errors, but that's to stop the action does not work!
    I've tried different actions: breakall (), stopall, stop (action (xxxx)) - does not work *cry*
    But try not to remove the button and when it sooo many times to press to "stop" — stop the actions.
    PS: Used the latest and previous versions of krpano player(flash)

    Thank you!

    Panoreal — to make and see this wonderful world! *whistling*

  • So, it's no works! *cursing*
    I can not stop the same actions:
    delayedcall(0.5, add(new_hlookat, view.hlookat, -10); tween(view.hlookat, get(new_hlookat),0.5);
    if they have already running!

    Stops all but the most shift view.v(h)lookat.

    How?

    Panoreal — to make and see this wonderful world! *whistling*

  • Hi Zephyr!
    I'm try many variants and many places where insert in code break; breakall(), stop (), stopall() and oninterrupt()+plus a listed.
    Does not want to work!
    Maybe I'm wrong embed code, or that it missed?

    I attach an example of a panorama with the code(download link):
    ars-test.zip

    In my simple example, autotour started at the end of time (4 seconds), if this interval to intervene, it does not start (see events). But I need to do so you can stop the action and while it is running on the "Stop" button is pushed

    PS: remove in code all variants of stop the runnings action

    Any idea?
    Thanks

    Sorry for my English *whistling*

    Panoreal — to make and see this wonderful world! *whistling*

    Edited once, last by Arsdezi (August 15, 2012 at 7:38 PM).

  • try this:

    you can use lookto instead of tween, and you don't need delayedcall, the animations will be executed after eachother. I'm not sure why stopall didnt stopp all the animation, maybe because the delayedcall already put them in queue. The true in stoptween means; use the shortest way, while the false means allow this animation to be interupted.

  • Thank you very much for your variant, Zephyr!
    But I need a performance of multiple movements of on the axes(x,y) and motion of plugin (Pictures).

    That's why I used the tween(view.hlookat); tween(view.vlookat); with a delay time (delayedcall).
    «Lookto» is a serial operation, please correct me if I'm wrong! *unsure*

    PS: Klaus, needs your help! :)

    Panoreal — to make and see this wonderful world! *whistling*

  • Hi,

    a delayedcall can't be stopped at the moment,

    the only way to stop it would be using a kind of 'stop' flag/variable, that will be checked in the delayedcall code,

    e.g. here two helper actions for creating stop-able delayedcalls - there each delayedcall need to have an unique id and that id can be used for stopping it:

    Code
    <!-- start_delayedcall(id, delay, code) --> 
    <action name="start_delayedcall">
      set(delayedcall_flag_%1, true);
      delayedcall(%2, if(delayedcall_flag_%1 == true, %3 ));
    </action>
    				
    <!-- stop_delayedcall(id) --> 
    <action name="stop_delayedcall">
      set(delayedcall_flag_%1, false);
    </action>

    best regards,
    Klaus

  • Thank you!
    I'll take your advice and examples.
    You are right, you need to stages start actions that can both run and not do the next step with the action.
    PS: I understand can still use opertator — events.onidle + idletime?

    Panoreal — to make and see this wonderful world! *whistling*

  • It would be great, if the delayedcall could work like the audio-plugin, where you can give each sound a specific name. Something like this: delayedcall(name,time,action)! And then we would be able to stop or even reset every delayedcall individually like "set(delayedcall[name].newtime,action);" or "set(delayedcall[name].stop);".
    Somehow the if(delayedcall_flag)-routine just does´nt work, which makes the use of delayedcall-actions in very complex tours very hard.

    Best regards
    Nupsi

  • It would be great, if the delayedcall could work like the audio-plugin, where you can give each sound a specific name. Something like this: delayedcall(name,time,action)! And then we would be able to stop or even reset every delayedcall individually like "set(delayedcall[name].newtime,action);" or "set(delayedcall[name].stop);".
    Somehow the if(delayedcall_flag)-routine just does´nt work, which makes the use of delayedcall-actions in very complex tours very hard.

    Best regards
    Nupsi

    I´m still hoping for a feature like this *attention* Klaus, any word, if this could be implemented into krpano, would be really appreciated *squint*
    This would make the use of delayedcall-actions sooo much easier!

    Thanks and best regards
    Nupsi

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!