UnityEssentials
Small but useful tools and features for Unity
|
Base class to create simple animations of any element. More...
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 |
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.
|
strong |
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.
|
pure virtual |
Returns the UnityEngine.Object animated. If not applicable, return null.
Implemented in UnityEngine.Vector3Animation, UnityEngine.Vector2Animation, UnityEngine.TransformAnimation, UnityEngine.RectTransformAnimation, UnityEngine.IntAnimation, UnityEngine.FloatAnimation, UnityEngine.ColorAnimation, and UnityEngine.CameraAnimation.
|
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
curve | THe desired type of curve. |
Definition at line 149 of file SimpleAnimation.cs.
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.
|
virtual |
Sets the animation at the given progress.
progress | The progress of the animation [0,1] |
Definition at line 166 of file SimpleAnimation.cs.
|
virtual |
Go forward or backwards in the animation.
deltaTime | The elapsed time between the last step and the current one. |
inverseIfMirror | If true, the delta time of the step will be inverted if the animation is set to mirror. |
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.
override string UnityEngine.SimpleAnimation.ToString | ( | ) |
Definition at line 138 of file SimpleAnimation.cs.
|
private |
Definition at line 23 of file SimpleAnimation.cs.
AnimationCurve UnityEngine.SimpleAnimation.curve |
The curve of the animation over time.
Definition at line 55 of file SimpleAnimation.cs.
float UnityEngine.SimpleAnimation.duration |
How much should the animation last?
Definition at line 50 of file SimpleAnimation.cs.
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.
string UnityEngine.SimpleAnimation.name |
The name of the animation
Definition at line 18 of file SimpleAnimation.cs.
UnityEvent UnityEngine.SimpleAnimation.onFinish |
Events executed when the animation finishes.
Definition at line 69 of file SimpleAnimation.cs.
UnityEvent UnityEngine.SimpleAnimation.onStep |
Events executed every time the animation advances.
Definition at line 64 of file SimpleAnimation.cs.
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.
|
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.
|
getset |
The progress of the animation. From 0 to 1.
Definition at line 27 of file SimpleAnimation.cs.
|
getprotected set |
The current moment/time of the animation. From 0 to duration.
Definition at line 22 of file SimpleAnimation.cs.