Custom Fading

All fades are linear by default, i.e. they move the AnimancerNode.Weight towards the AnimancerNode.TargetWeight at a constant AnimancerNode.FadeSpeed calculated when starting the fade. But that does not always give the smoothest transitions so Animancer includes a CustomFade system which allows you to modify a fade progress using a standard Easing.Function, an AnimationCurve, or a custom delegate.

The 3D Game Kit example demonstrates the use of this feature to smooth out the transitions between its Idle animations.

To use the system, simply call any of the static CustomFade.Apply methods right after calling animancer.Play normally:

[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private AnimationClip _Clip;

private void Awake()
    // Start fading the animation normally.
    var state = _Animancer.Play(_Clip, 0.25f);
    // Then apply the custom fade to modify the state you are fading in.
    CustomFade.Apply(state, Easing.Sine.InOut);// Use a delegate.
    CustomFade.Apply(state, Easing.Function.SineInOut);// Or use the Function enum.
    // Or apply it to whatever the current state happens to be.
    CustomFade.Apply(_Animancer, Easing.Sine.InOut);
    // Anything else you play after this will automatically cancel the custom fade.

The CustomFade system is located in the Utilities folder, meaning that its source code is even included in Animancer Lite to demonstrate how the system can be extended, however it relies on the ability to set the AnimancerNode.Weight which is a Pro-Only Feature so it cannot be used in runtime builds unless you purchase Animancer Pro.

Curve Preset Libraries

AnimationCurve fields are convenient for easily visualising and editing curve functions in the Inspector, however they can be somewhat tedious to set up complex and consistent curves. Fortunately, Unity allows you to define Curve Preset Libraries so you can simply download the Animancer Curve Presets from here and use them as a starting point for your own curves. Note that these curves were configured by hand with the minimum number of keyframes for efficiency. They do not cover the exact same set of functions as the Easing class and any that have the same name will have slight differences in their exact values.