Smooth transition when anim removed?

Hi guys

Currently, JME animation only does smooth transitions at the beginning of animation when a new animation is started but not when the animation is removed. For example, suppose there is an idle animation being played on the DEFAULT layer, now we also want to play an attack animation on the right arm, it will make a smooth transition from idle animation to attack animation on the right arm when the attack animation is started, but if we remove the attack animation when it finishes or while it is playing, then the right arm will suddenly jump back to idle animation without doing a smooth transition. Any idea how to implement a smooth transition in this case when an animation is removed from an upper layer?


I think I found a quick solution.

Added a field maxTransitionWeight in BlendableAction class then modified the internal TransitionTween class to make use of it:

transitionWeight = (float) Math.min(t, maxTransitionWeight);

I set the maxTransitionWeight to something belove 1 (e.g. 0.5) on the looping animation and use a higher value (e.g. 0.9) for the nonlooping animations and It produces a smooth transition when animation is removed. :slight_smile:


Submitted a PR that includes this and a bunch of other frequently requested features :cowboy_hat_face:

Option to enable/disable animation mask propagation to child actions.
Option to control max transition weight. For example useful for controlling smooth animation transition when an animation is removed from an upper layer.
Added animation loop support in AnimLayer.
AnimLayer can now also keep the action name, so one can easily look up the currently playing action name in a specific layer.