UnityEssentials
Small but useful tools and features for Unity
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Properties | Private Attributes | List of all members
UnityEngine.FloatAnimation Class Reference

Allows the animation of a float. More...

Collaboration diagram for UnityEngine.FloatAnimation:
Collaboration graph

Public Types

enum class  WrapMode { Once , Loop , PingPong }
 How the animation behaves once finished. Should be executed only once? Start over? Go back? More...
 

Public Member Functions

 FloatAnimation ()
 
 FloatAnimation (float floatToAnimate, float destination, float origin, float duration=1f, Curve curve=Curve.EaseInOut, WrapMode wrapMode=WrapMode.Once)
 
override bool Step (float deltaTime, bool inverseIfMirror=true)
 Go forward or backwards in the animation. More...
 
override Object GetAnimatedObject (bool displayWarningIfNotApplicable)
 Returns the UnityEngine.Object animated. If not applicable, return null. More...
 
void Reset ()
 Sets the time stamps of the animation to the beginning (the behaviour changes depending on if the animation is set as mirror or not). More...
 
override string ToString ()
 
virtual void SetProgress (float progress)
 Sets the animation at the given progress. More...
 

Static Public Member Functions

static AnimationCurve GetCurve (Curve curve)
 Obtains the desired type of animation curve with a duration of 1 (starting on 0), the start value being 0 and the end value being 1 More...
 

Public Attributes

float floatToAnimate
 The animated float More...
 
float originFloat
 The float at the start of the animation More...
 
float destinationFloat
 The float at the end of the animation More...
 
string name
 The name of the animation More...
 
WrapMode wrapMode
 Determines how the animation behaves once finished. Should be executed only once? Start over? Go back? More...
 
bool mirror
 Should the animation be played from end to start instead of from start to end? More...
 
float duration
 How much should the animation last? More...
 
AnimationCurve curve
 The curve of the animation over time. More...
 
UnityEvent onStep
 Events executed every time the animation advances. More...
 
UnityEvent onFinish
 Events executed when the animation finishes. More...
 

Properties

float timeStamp [get, protected set]
 The current moment/time of the animation. From 0 to duration. More...
 
float progress [get, set]
 The progress of the animation. From 0 to 1. More...
 
float currentAnimationCurveValue [get]
 The value of the animation at the current time. 0 means start state. 1 means end state. More...
 

Private Attributes

float _timeStamp
 

Detailed Description

Allows the animation of a float.

Definition at line 9 of file FloatAnimation.cs.

Member Enumeration Documentation

◆ WrapMode

How the animation behaves once finished. Should be executed only once? Start over? Go back?

Enumerator
Once 
Loop 
PingPong 

Definition at line 75 of file SimpleAnimation.cs.

Constructor & Destructor Documentation

◆ FloatAnimation() [1/2]

UnityEngine.FloatAnimation.FloatAnimation ( )

Definition at line 28 of file FloatAnimation.cs.

◆ FloatAnimation() [2/2]

UnityEngine.FloatAnimation.FloatAnimation ( float  floatToAnimate,
float  destination,
float  origin,
float  duration = 1f,
Curve  curve = Curve.EaseInOut,
WrapMode  wrapMode = WrapMode.Once 
)

Definition at line 30 of file FloatAnimation.cs.

Here is the call graph for this function:

Member Function Documentation

◆ GetAnimatedObject()

override Object UnityEngine.FloatAnimation.GetAnimatedObject ( bool  displayWarningIfNotApplicable)
virtual

Returns the UnityEngine.Object animated. If not applicable, return null.

Implements UnityEngine.SimpleAnimation.

Definition at line 51 of file FloatAnimation.cs.

◆ GetCurve()

static AnimationCurve UnityEngine.SimpleAnimation.GetCurve ( Curve  curve)
staticinherited

Obtains the desired type of animation curve with a duration of 1 (starting on 0), the start value being 0 and the end value being 1

Parameters
curveTHe desired type of curve.
Returns
The desired type of animation curve with a duration of 1 (starting on 0), the start value being 0 and the end value being 1

Definition at line 149 of file SimpleAnimation.cs.

Here is the caller graph for this function:

◆ Reset()

void UnityEngine.SimpleAnimation.Reset ( )
inherited

Sets the time stamps of the animation to the beginning (the behaviour changes depending on if the animation is set as mirror or not).

Definition at line 132 of file SimpleAnimation.cs.

Here is the caller graph for this function:

◆ SetProgress()

virtual void UnityEngine.SimpleAnimation.SetProgress ( float  progress)
virtualinherited

Sets the animation at the given progress.

Parameters
progressThe progress of the animation [0,1]

Definition at line 166 of file SimpleAnimation.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Step()

override bool UnityEngine.FloatAnimation.Step ( float  deltaTime,
bool  inverseIfMirror = true 
)
virtual

Go forward or backwards in the animation.

Parameters
deltaTimeThe elapsed time between the last step and the current one.
inverseIfMirrorIf true, the delta time of the step will be inverted if the animation is set to mirror.
Returns
True if the animation should have ended. False if the animation should still in progress.

Reimplemented from UnityEngine.SimpleAnimation.

Definition at line 42 of file FloatAnimation.cs.

◆ ToString()

override string UnityEngine.SimpleAnimation.ToString ( )
inherited

Definition at line 138 of file SimpleAnimation.cs.

Member Data Documentation

◆ _timeStamp

float UnityEngine.SimpleAnimation._timeStamp
privateinherited

Definition at line 23 of file SimpleAnimation.cs.

◆ curve

AnimationCurve UnityEngine.SimpleAnimation.curve
inherited

The curve of the animation over time.

Definition at line 55 of file SimpleAnimation.cs.

◆ destinationFloat

float UnityEngine.FloatAnimation.destinationFloat

The float at the end of the animation

Definition at line 25 of file FloatAnimation.cs.

◆ duration

float UnityEngine.SimpleAnimation.duration
inherited

How much should the animation last?

Definition at line 50 of file SimpleAnimation.cs.

◆ floatToAnimate

float UnityEngine.FloatAnimation.floatToAnimate

The animated float

Definition at line 15 of file FloatAnimation.cs.

◆ mirror

bool UnityEngine.SimpleAnimation.mirror
inherited

Should the animation be played from end to start instead of from start to end?

Definition at line 45 of file SimpleAnimation.cs.

◆ name

string UnityEngine.SimpleAnimation.name
inherited

The name of the animation

Definition at line 18 of file SimpleAnimation.cs.

◆ onFinish

UnityEvent UnityEngine.SimpleAnimation.onFinish
inherited

Events executed when the animation finishes.

Definition at line 69 of file SimpleAnimation.cs.

◆ onStep

UnityEvent UnityEngine.SimpleAnimation.onStep
inherited

Events executed every time the animation advances.

Definition at line 64 of file SimpleAnimation.cs.

◆ originFloat

float UnityEngine.FloatAnimation.originFloat

The float at the start of the animation

Definition at line 20 of file FloatAnimation.cs.

◆ wrapMode

WrapMode UnityEngine.SimpleAnimation.wrapMode
inherited

Determines how the animation behaves once finished. Should be executed only once? Start over? Go back?

Definition at line 40 of file SimpleAnimation.cs.

Property Documentation

◆ currentAnimationCurveValue

float UnityEngine.SimpleAnimation.currentAnimationCurveValue
getinherited

The value of the animation at the current time. 0 means start state. 1 means end state.

Definition at line 59 of file SimpleAnimation.cs.

◆ progress

float UnityEngine.SimpleAnimation.progress
getsetinherited

The progress of the animation. From 0 to 1.

Definition at line 27 of file SimpleAnimation.cs.

◆ timeStamp

float UnityEngine.SimpleAnimation.timeStamp
getprotected setinherited

The current moment/time of the animation. From 0 to duration.

Definition at line 22 of file SimpleAnimation.cs.


The documentation for this class was generated from the following file: