17 [Tooltip(
"The name of the animation")]
18 [SerializeField]
public string name;
39 [Tooltip(
"Determines how the animation behaves once finished. Should be executed only once? Start over? Go back?")]
44 [Tooltip(
"Should the animation be played from end to start instead of from start to end?")]
49 [Tooltip(
"How much should the animation last?")]
54 [Tooltip(
"The curve of the animation over time. The bottom is the start state and the top is end state.")]
55 [SerializeField]
public AnimationCurve
curve;
63 [Tooltip(
"Events executed every time the animation advances")]
64 [SerializeField]
public UnityEvent
onStep;
68 [Tooltip(
"Events executed when the animation finishes")]
88 public virtual bool Step(
float deltaTime,
bool inverseIfMirror =
true)
90 if (!
mirror || !inverseIfMirror)
95 Debug.LogError(
"Unexpected Step call for a SimpleAnimation.");
120 throw new ArgumentOutOfRangeException();
154 return AnimationCurve.Linear(0, 0, 1, 1);
155 case Curve.EaseInOut:
156 return AnimationCurve.EaseInOut(0, 0, 1, 1);
158 throw new ArgumentOutOfRangeException(nameof(
curve),
curve,
null);
Curve
Predefined curves for the SimpleAnimations
Base interface to create simple animations of any element.
Base class to create simple animations of any element.
WrapMode
How the animation behaves once finished. Should be executed only once? Start over?...
float timeStamp
The current moment/time of the animation. From 0 to duration.
float duration
How much should the animation last?
float progress
The progress of the animation. From 0 to 1.
AnimationCurve curve
The curve of the animation over time.
UnityEvent onFinish
Events executed when the animation finishes.
void Reset()
Sets the time stamps of the animation to the beginning (the behaviour changes depending on if the ani...
override string ToString()
float currentAnimationCurveValue
The value of the animation at the current time. 0 means start state. 1 means end state.
UnityEvent onStep
Events executed every time the animation advances.
WrapMode wrapMode
Determines how the animation behaves once finished. Should be executed only once? Start over?...
string name
The name of the animation
virtual void SetProgress(float progress)
Sets the animation at the given progress.
static AnimationCurve GetCurve(Curve curve)
Obtains the desired type of animation curve with a duration of 1 (starting on 0), the start value bei...
abstract UnityEngine.Object GetAnimatedObject(bool displayWarningIfNotApplicable=true)
Returns the UnityEngine.Object animated. If not applicable, return null.
bool mirror
Should the animation be played from end to start instead of from start to end?
virtual bool Step(float deltaTime, bool inverseIfMirror=true)
Go forward or backwards in the animation.