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-v7-4/api/Animancer/Key" Base0-->Base1["Object"] Type-.->Interface0["IUpdatable"] click Interface0 "/animancer-v7-4/api/Animancer/IUpdatable" Type-.->Interface1["Key.IListItem"] click Interface1 "/animancer-v7-4/api/Animancer/IListItem" Type["CustomFade"] class Type type-node

Syntax

public abstract class CustomFade : Key, IUpdatable, Key.IListItem

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

Fields

Name Constant Value Summary
NotInList -1
The Animancer.Key._Index which indicates that an item isn't in a list.
Inherited from Key
static

Methods

Name Value Summary
Apply(AnimancerComponent, AnimationCurve) void
Modify the current fade to use the specified `curve` to calculate the weight.
static
Apply(AnimancerComponent, Easing.Function) void
Modify the current fade to use the specified `function` to calculate the weight.
static
Apply(AnimancerComponent, Func<float, float>) void
Modify the current fade to use the specified `calculateWeight` delegate.
static
Apply(AnimancerNode) void
Gathers 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(AnimancerNode, AnimationCurve) void
Modify the current fade to use the specified `curve` to calculate the weight.
static
Apply(AnimancerNode, Easing.Function) void
Modify the current fade to use the specified `function` to calculate the weight.
static
Apply(AnimancerNode, Func<float, float>) void
Modify the current fade to use the specified `calculateWeight` delegate.
static
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
Gathers 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
Is the `key` currently in a keyed list?
Inherited from Key
static
Release() void
Called when this fade is cancelled (or ends).