AnimationUtility
AnimationUtility is a static utility class to be used with all animation types. The full API docs can be found here.
Raw Positions & Deltas
One of TMPAnimator's settings is a toggle that decides whether animations should be scaled or not (see TMPAnimator Settings).
In some cases, you will want to ignore this scaling in your animation though. For example, the built-in spread
animation sets the individual vertices of the character to the center point of the character, to make it invisible at first and then over time spread out from the center point
to the original vertex positions. If this was scaled, then the vertices would in many cases move either not enough, or too far, to make the character invisible.
These methods allow you to get and set positions and deltas that ignore the scaling of the animator:
Getters
Vector3 GetRawVertex(int index, Vector3 position, CharData cData, ref IAnimationContext ctx) - Calculate the raw version of the passed in vertex position, i.e. the one that will ignore the animator's scaling.
Vector3 GetRawPosition(Vector3 position, CharData cData, ref IAnimationContext ctx) - Calculate the raw version of the passed in character position, i.e. the one that will ignore the animator's scaling.
Vector3 GetRawDelta(Vector3 delta, CharData cData, ref IAnimationContext ctx) - Calculate the raw version of the passed in delta, i.e. the one that will ignore the animator's scaling.
Setters
void SetVertexRaw(int index, Vector3 position, CharData cData, IAnimationContext ctx) - Set the raw position of the vertex at the given index. This position will ignore the animator's scaling.
void SetPositionRaw(Vector3 position, CharData cData, IAnimationContext ctx) - Set the raw position of the character. This position will ignore the animator's scaling.
void AddVertexDeltaRaw(int index, Vector3 delta, CharData cData, IAnimationContext ctx) - Add a raw delta to the vertex at the given index. This delta will ignore the animator's scaling.
void AddPositionDeltaRaw(Vector3 delta, CharData cData, IAnimationContext ctx) - Add a raw delta to the position of the character. This delta will ignore the animator's scaling.
AnchorToPosition
Given a Vector2 that represents an anchor (see ParameterTypes), you can calculate the actual position on the character using the Vector2 AnchorToPosition(Vector2 anchor, CharData cData) method.
GetValue
A simple wrapper method that allows you to evaluate an AnimationCurve in any WrapMode.