// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2026 Kybernetik //
using UnityEngine;
namespace Animancer
{
/// An object which can create an and set its details.
///
/// Transitions are generally used as arguments for .
///
/// Documentation:
///
/// Transitions
///
/// https://kybernetik.com.au/animancer/api/Animancer/ITransition
public interface ITransition :
IHasEvents,
IHasKey,
IPolymorphic
// Most transition types return themselves as the IHasKey.Key, but some wrapper types like
// TransitionAsset and TransitionAssetReference contain another transition which they want to
// use as the key instead so all transitions must implement it so systems can support any type.
{
/************************************************************************************************************************/
// Core Members - The main features required for a transition to be usable.
/************************************************************************************************************************/
/// The amount of time this transition should take (in seconds).
float FadeDuration { get; }
///
/// The which should be used when this transition is passed into
/// .
///
FadeMode FadeMode { get; }
/// Creates and returns a new defuned by this transition.
///
/// The first time a transition is used on an object, this method creates a state
/// which is registered in the internal dictionary using the
/// so that it can be reused later on.
///
/// Methods like will also call ,
/// so if you call this method manually you may want to call that method as well.
/// Or you can just use .
///
AnimancerState CreateState();
/// Applies the details of this transition to the `state`.
/// This method is called by every .
void Apply(AnimancerState state);
/************************************************************************************************************************/
// Extra Members - Additional features for convenience.
/************************************************************************************************************************/
/// Can this transition create a valid ?
///
/// Use to check for null as well.
///
bool IsValid { get; }
/// What will the value of be for the created state?
bool IsLooping { get; }
/// The to start the animation at.
/// allows the animation to continue from its current time.
float NormalizedStartTime { get; set; }
/// The maximum expected value of the .
///
/// In a this is equal to the
/// but the actual length can vary depending on the current parameters in states like
/// and .
///
float MaximumLength { get; }
/// The to play the animation at.
float Speed { get; set; }
/************************************************************************************************************************/
}
/// An which creates a specific type of .
///
/// Documentation:
///
/// Transitions
///
/// https://kybernetik.com.au/animancer/api/Animancer/ITransition_1
public interface ITransition : ITransition
where TState : AnimancerState
{
/************************************************************************************************************************/
///
/// The state that was created by this object. Specifically, this is the state that was most recently
/// passed into (usually by ).
///
TState State { get; }
/************************************************************************************************************************/
/// Creates and returns a new .
new TState CreateState();
/************************************************************************************************************************/
}
}