Mixer Smoothing

Setting the Parameter of a Mixer will instantly change its blending, but there are several ways you can do it smoothly over time depending on how you want to control it:

  • Variable Target if the target value can change continuously.
  • Fixed Target if you want to just set the target value and let it go there over time (like with Fading).

Variable Target

If the target value can change constantly then you can simply use a MoveTowards function to move the Parameter a certain distance towards the target value every frame. For example, if you are controlling a movement Mixer based on player input from a joystick then you might want to limit how quickly the character can snap from one direction to another.

1D 2D
Mathf.MoveTowards Vector2.MoveTowards
// How fast the parameter changes.
[SerializeField] private float _BlendSpeed;

private LinearMixerState _Mixer;

private void Update()
{
    var input = Input.GetAxisRaw("Vertical");

    _Mixer.Parameter = Mathf.MoveTowards(
        _Mixer.Parameter,
        input,
        _BlendSpeed * Time.deltaTime);
}
// How fast the parameter changes.
[SerializeField] private float _BlendSpeed;

// A Cartesian or Directional Mixer.
private MixerState<Vector2> _Mixer;

private void Update()
{
    var input = new Vector2(
        Input.GetAxisRaw("Horizontal"),
        Input.GetAxisRaw("Vertical"));

    _Mixer.Parameter = Vector2.MoveTowards(
        _Mixer.Parameter,
        input,
        _BlendSpeed * Time.deltaTime);
}

Fixed Target

If you just want to set the target value for it to move towards on its own, then you can use a MixerParameterTweenFloat (for 1D Mixers) or MixerParameterTweenVector2 (for 2D Mixers):

[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private LinearMixerTransition _Mixer;

private MixerParameterTweenFloat _MixerTween;

private void Awake()
{
    _Animancer.Play(_Mixer);

    // Initialize the tween with the Mixer it will control.
    _MixerTween = new MixerParameterTweenFloat(_Mixer.State);
}

public void BlendMixerParameter(float parameter, float duration)
{
    // Start interpolating the Mixer parameter.
    _MixerTween.Start(parameter, duration);
}

That will move the _Mixer.Parameter towards the specified parameter every frame and reach it at the end of the duration. You can call Start again to interrupt the previous target, but if you are doing that very often then the Variable Target approach described above might be more effective.