Playing backwards an animation

  • Hi, I have a sprite image sequence of 5 frames that starts playing and then stops on the last frame, I want to get it playing backwards after that, from frame 5 to frame 0! I tried but noway! *unsure* Could someone please let me know how to do it from klaus animation code:

    <action name="do_crop_animation" scope="local" args="framewidth, frameheight, framerate">
    <!-- define local variables -->
    calc(local.xframes, (caller.imagewidth /framewidth) BOR 0);
    calc(local.frames, xframes * ((caller.imageheight / frameheight) BOR 0));
    def(local.frame, integer, 0);

    <!-- set the first frame -->
    calc(caller.crop, '0|0|' + framewidth + '|' + frameheight);

    <!-- do the animation -->
    setinterval(calc('crop_anim_' + caller.name), calc(1.0 / framerate),
    if(caller.loaded,
    inc(frame);
    if(frame GE frames, set(frame,4);clearinterval(calc('crop_anim_' + caller.name)); );
    mod(xpos, frame, xframes);
    div(ypos, frame, xframes);
    Math.floor(ypos);
    mul(xpos, framewidth);
    mul(ypos, frameheight);
    calc(caller.crop, xpos + '|' + ypos + '|' + framewidth + '|' + frameheight);
    trace(scoubidou);
    ,
    <!-- stop the interval when the hotspot gets removed -->
    clearinterval(calc('crop_anim_' + caller.name));
    );
    );
    </action>

    Thank you so much!

  • Hi,

    something like:

    not sure if it is perfect but seems to work quite ok.
    http://www.virtualtuur.com/krpano/animatedhotspots/reverse/

    btw if you have bigger, multi rows or column sprites i made a script for that.
    https://krpano.com/forum/wbb/inde…d&postID=56502&

    Tuur *thumbsup*

Participate now!

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