Search Unity

Question Ho do change to another Animation without reset to first frame

Discussion in 'Animation' started by nicklowkc1, Jun 7, 2021.

  1. nicklowkc1

    nicklowkc1

    Joined:
    Feb 27, 2019
    Posts:
    28
    I am using SimpleAnimation instead animator to easily control the flow of animation. I am wondering whether SimpleAnimation can prevent the animation reset to first frame when changing state.
    For an example, I have two animation name in and out, where in increase the scale of a sprite from 0 to 10 while out decrease the scale of a sprite from 10 to 0.
    Each state is controlled when pressing some keys. While testing the animations it work as expected, but I want to do something like if the animation is "in" the animation progress is at the middle and I pressed some key to change the state to "out". The result seems like the animation doesn't scale down from the middle and it just started from the first frame. But I want the scale's value of the first frame to be "dynamic", which means like from 5 to 0 instead of 10.
    Is that possible to achieve this in animation?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    It has been a while since I looked at the code of Simple Animation (and they abandoned the system a few years ago with a bunch of bugs that never got fixed), but if it's not obvious how to do it then the system probably wasn't designed to do it so you'd need to modify it yourself.

    Or you could check out Animancer (link in my signature) which is far more powerful and easier to use than Simple Animation. The Spider Bot and Doors examples both demonstrate animation time manipulation and show how you could actually do what you want with only one animation for the in transition which you simply play backwards for the out transition.
     
  3. nicklowkc1

    nicklowkc1

    Joined:
    Feb 27, 2019
    Posts:
    28
    Hi, thank you for your reply. I am not sure if I need Animancer for now but it's in my list. Thanks!