This is the old Animancer v7.4 documentation. Animancer v8.0 is now available.

Fading

As explained on the Playing Animations page, there are several different sets of parameters you can specify when calling AnimancerComponent.Play depending on whether you want it to immediately snap to the new animation or gradually fade it in over time while fading the previous animation out (known as "Cross-Fading").

Fading is not generally used for Sprite animations because they cannot be blended, however is very useful for Skeletal Animations because it allows a character model to smoothly transition from the ending pose of one animation into the starting pose of another animation without requiring both poses to be exactly the same. It also means that the transition can still be smooth if an animation is interrupted at any time.

The Transitions example demonstrates the use of this feature in more detail.

Durations

Fading is supported in Animancer Lite, however the ability to specify a custom fade duration is a Pro-Only Feature so it will always use the default 0.25 seconds in runtime builds unless you purchase Animancer Pro.

void CrossFadeExample(AnimancerComponent animancer, AnimationClip clip)
{
    // Default 0.25 seconds fade duration.
    animancer.Play(clip, AnimancerPlayable.DefaultFadeDuration);

    // Fade over 0.8 seconds.
    animancer.Play(clip, 0.8f);

    // Fade for 20% of the new clip's duration.
    animancer.Play(clip, clip.length * 0.2f);
    animancer.Play(clip, 0.2f, FadeMode.NormalizedSpeed);

    // Fade for 10% of the old clip's duration.
    animancer.Play(clip, animancer.States.Current.Length * 0.1f);
}

Individual Fading

When you call the Play method with a fade duration, it internally calls AnimancerNode.StartFade on every animation. For example, if you have Idle, Walk, and Jump animations and you call Play(walk, 0.25f), it will call StartFade(1, 0.25f) on the walk state and StartFade(0, 0.25f) on the others. This means you can use StartFade to control individual states rather than only cross-fading all of them at once.

AnimancerLayer also inherits from AnimancerNode which means that you can fade entire Layers in and out. There is no CrossFade for layers because they are not commonly used in that manner, but you can achieve the same thing by calling StartFade(0, fadeDuration) to fade some layers out and StartFade(1, fadeDuration) to fade others in. The Layers example makes use of this feature to fade out the upper body layer once it is no longer needed so that the base layer can resume controlling the character's entire body.

Fade Modes There are various different modes that determine how the fade duration is interpreted and can allow animations to fade into themselves.
Custom Fading Replace the default linear interpolation fade with a custom curve