We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

How to reverse an animation clip from its current frame rather than at its last

Home Forums Puzzles How to reverse an animation clip from its current frame rather than at its last

Tagged: ,

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #17440
    D3Pixel
    Customer

    Hi

    I have a model with 20 parts, I have a HTML button called “disassemble” that plays all animation clips so the model explodes outwards. It does this with a 0.5 sec offset of each part so they all play quickly rather than waiting for a previous clip to finish. It takes about 4 seconds to complete.

    However, how can I make it play in reverse if the user presses “assemble” while the disassemble animation is still playing. I need to reverse the animation clips from their current frame for a smooth effect but having difficulty working out the puzzle to make this happen.

    Any help would be much appreciated.

    3D Animation and Web3D services - www.d3pixel.co.uk

    #17446

    Hi,

    Unfortunately, at the moment this behavior cannot be efficiently implemented with Puzzles. I’ve created a task in our dev tracker to make it possible in the future.

    Chief 3D Verger | LinkedIn | Twitter

    #17455
    D3Pixel
    Customer

    Hi Yuri

    I will try and do this in JS instead then. Thanks for answering.

    3D Animation and Web3D services - www.d3pixel.co.uk

    #17459

    You can check the code generated by the play animation and pause/resume animation puzzles. It can be seen from visual_logic.js. A quick and dirty solution would be just add the reverse function to the resume animation puzzle code, so that it always changes the direction of animation once resumed.

    Chief 3D Verger | LinkedIn | Twitter

    #17461
    D3Pixel
    Customer

    Great, will look there first thanks.

    3D Animation and Web3D services - www.d3pixel.co.uk

    #17474
    D3Pixel
    Customer

    Hi Yuri

    Adding

     rev = true;
     if (rev)
        timeScale *= -1;

    to case "RESUME":

    doesn’t reverse the frames as I assume the rev parameter is being passed in constantly as false from the puzzle so I can not override it later in the case statement. Adding in the entire timeScale code from PLAY check into the RESUME check also did not reverse the frames.

    Any ideas?
    Thanks

    3D Animation and Web3D services - www.d3pixel.co.uk

    #17497

    You can try adding this line to the RESUME case:

    action.timeScale = -action.timeScale;

    See if it helps.

    Chief 3D Verger | LinkedIn | Twitter

    #17533
    D3Pixel
    Customer

    Fantastic, that worked perfectly. So I should have been modifying the action, I get that now. Thanks Yuri.

    3D Animation and Web3D services - www.d3pixel.co.uk

    #17537

    glad it worked out!

    Chief 3D Verger | LinkedIn | Twitter

    #55092
    fred7
    Customer

    Hello,
    Is this now possible to do with puzzles? I need exactly the same. I got a structure which flips open and can be closed again with two HTML buttons. For the shape key object it works perfectly. Just need it for the animated object.

    Please see the screenshot attached.

    Thank You!

    Attachments:
    You must be logged in to view attached files.
    #55094
    kdv
    Participant

    Use the get animation frame puzzle to set the last frame in the reversed animation or the first frame in the direct animation.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #55095
    fred7
    Customer

    Many thanks! Tried that puzzle before, but did put it wrong.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.