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.SimpleAnimation Class Referenceabstract

Base class to create simple animations of any element. More...

Collaboration diagram for UnityEngine.SimpleAnimation:
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

virtual bool Step (float deltaTime, bool inverseIfMirror=true)
 Go forward or backwards in the animation. 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...
 
abstract UnityEngine.Object GetAnimatedObject (bool displayWarningIfNotApplicable=true)
 Returns the UnityEngine.Object animated. If not applicable, return null. 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

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

Base class to create simple animations of any element.

It can be used to animate cameras, int, floats, vectors, transforms, ...

Definition at line 12 of file SimpleAnimation.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.

Member Function Documentation

◆ GetAnimatedObject()

abstract UnityEngine.Object UnityEngine.SimpleAnimation.GetAnimatedObject ( bool  displayWarningIfNotApplicable = true)
pure virtual

◆ GetCurve()

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

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 ( )

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)
virtual

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()

virtual bool UnityEngine.SimpleAnimation.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 in UnityEngine.Vector3Animation, UnityEngine.Vector2Animation, UnityEngine.TransformAnimation, UnityEngine.RectTransformAnimation, UnityEngine.IntAnimation, UnityEngine.FloatAnimation, UnityEngine.ColorAnimation, and UnityEngine.CameraAnimation.

Definition at line 88 of file SimpleAnimation.cs.

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

◆ ToString()

override string UnityEngine.SimpleAnimation.ToString ( )

Definition at line 138 of file SimpleAnimation.cs.

Member Data Documentation

◆ _timeStamp

float UnityEngine.SimpleAnimation._timeStamp
private

Definition at line 23 of file SimpleAnimation.cs.

◆ curve

AnimationCurve UnityEngine.SimpleAnimation.curve

The curve of the animation over time.

Definition at line 55 of file SimpleAnimation.cs.

◆ duration

float UnityEngine.SimpleAnimation.duration

How much should the animation last?

Definition at line 50 of file SimpleAnimation.cs.

◆ mirror

bool UnityEngine.SimpleAnimation.mirror

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

The name of the animation

Definition at line 18 of file SimpleAnimation.cs.

◆ onFinish

UnityEvent UnityEngine.SimpleAnimation.onFinish

Events executed when the animation finishes.

Definition at line 69 of file SimpleAnimation.cs.

◆ onStep

UnityEvent UnityEngine.SimpleAnimation.onStep

Events executed every time the animation advances.

Definition at line 64 of file SimpleAnimation.cs.

◆ wrapMode

WrapMode UnityEngine.SimpleAnimation.wrapMode

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
get

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
getset

The progress of the animation. From 0 to 1.

Definition at line 27 of file SimpleAnimation.cs.

◆ timeStamp

float UnityEngine.SimpleAnimation.timeStamp
getprotected set

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: