// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
using System;
namespace Animancer
{
/// Extension methods for .
/// https://kybernetik.com.au/animancer/api/Animancer/FadeGroupExtensions
public static class FadeGroupExtensions
{
/************************************************************************************************************************/
/// [Pro-Only]
/// Assigns the `function` as the if the `fade` isn't null.
///
///
/// Animancer Lite ignores this feature in runtime builds.
///
/// Example:
/// void EasingExample(AnimancerComponent animancer, AnimationClip clip)
/// {
/// // Start fading the animation normally.
/// AnimancerState state = animancer.Play(clip, 0.25f);
///
/// // Then a custom Easing delegate to modify it.
/// state.FadeGroup.SetEasing(t => t * t);// Square the 0-1 value to start slow and end fast.
///
/// // The Easing class has lots of standard mathematical curve functions.
/// state.FadeGroup.SetEasing(Easing.Sine.InOut);
///
/// // Or you can use the Easing.Function enum.
/// state.FadeGroup.SetEasing(Easing.Function.SineInOut);
/// }
///
///
public static void SetEasing(this FadeGroup fade, Func function)
{
if (fade != null)
fade.Easing = function;
}
/************************************************************************************************************************/
/// [Pro-Only]
/// Assigns the as the
/// if the `fade` isn't null.
///
///
/// Animancer Lite ignores this feature in runtime builds.
///
/// Example:
/// void EasingExample(AnimancerComponent animancer, AnimationClip clip)
/// {
/// // Start fading the animation normally.
/// AnimancerState state = animancer.Play(clip, 0.25f);
///
/// // Then a custom Easing delegate to modify it.
/// state.FadeGroup.SetEasing(t => t * t);// Square the 0-1 value to start slow and end fast.
///
/// // The Easing class has lots of standard mathematical curve functions.
/// state.FadeGroup.SetEasing(Easing.Sine.InOut);
///
/// // Or you can use the Easing.Function enum.
/// state.FadeGroup.SetEasing(Easing.Function.SineInOut);
/// }
///
///
public static void SetEasing(this FadeGroup fade, Easing.Function function)
{
if (fade != null)
fade.Easing = function.GetDelegate();
}
/************************************************************************************************************************/
}
}