CustomFade Class

Summary

[Pro-Only] A system which fades animation weights animations using a custom calculation rather than linear interpolation.
Assembly
Animancer.dll
Namespace
Animancer
Interfaces
Base Types
graph BT Type-->Base0["Key"] click Base0 "/animancer/api/Animancer/Key" Base0-->Base1["Object"] Type-.->Interface0["IUpdatable"] click Interface0 "/animancer/api/Animancer/IUpdatable" Type-.->Interface1["IKeyedListItem"] click Interface1 "/animancer/api/Animancer/IKeyedListItem" Type["CustomFade"] class Type type-node

Syntax

public abstract class CustomFade : Key, IUpdatable, IKeyedListItem

Examples

[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 it.
    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 that will automatically cancel the custom fade.
}

Remarks

Documentation: Custom Fade

Methods

Name Value Summary
Apply(AnimancerPlayable) void
Gather the current details of the Animancer.AnimancerPlayable and register this Animancer.CustomFade to be updated by it so that it can replace the regular fade behaviour.
Apply(AnimancerPlayable, AnimationCurve) void
Modify the current fade to use the specified `curve` to calculate the weight.
static
Apply(AnimancerPlayable, Easing.Function) void
Modify the current fade to use the specified `function` to calculate the weight.
static
Apply(AnimancerPlayable, Func<float, float>) void
Modify the current fade to use the specified `calculateWeight` delegate.
static
Apply(AnimancerState) void
Gather the current details of the Animancer.AnimancerNode.Root and register this Animancer.CustomFade to be updated by it so that it can replace the regular fade behaviour.
Apply(AnimancerState, AnimationCurve) void
Modify the current fade to use the specified `curve` to calculate the weight.
static
Apply(AnimancerState, Easing.Function) void
Modify the current fade to use the specified `function` to calculate the weight.
static
Apply(AnimancerState, Func<float, float>) void
Modify the current fade to use the specified `calculateWeight` delegate.
static
CalculateWeight(float) float
Returns the desired weight for the target state at the specified `progress` (ranging from 0 to 1).
IndexOf(Key) int
Returns location of this object in the list (or -1 if it is not currently in a keyed list).
Inherited from Key
static
IsInList(Key) bool
Indicates whether the specified object is currently in a keyed list.
Inherited from Key
static
Release() void
Called when this fade is cancelled (or ends).