Class AnimationUtility
- Namespace
- TMPEffects.TMPAnimations
- Assembly
- TMPEffects.dll
Utility methods for animations.
public static class AnimationUtility
- Inheritance
-
AnimationUtility
- Inherited Members
Methods
AddPivotDeltaRaw(Vector3, CharData, IAnimatorContext)
Add a raw delta to the pivot of the character. This delta will ignore the animator's scaling.
public static void AddPivotDeltaRaw(Vector3 delta, CharData cData, IAnimatorContext ctx)
Parameters
delta
Vector3The delta to add to the pivot.
cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimatorContext of the animation.
AddPivotDeltaRaw(Vector3, CharData, IAnimationContext)
Add a raw delta to the pivot of the character. This delta will ignore the animator's scaling.
public static void AddPivotDeltaRaw(Vector3 delta, CharData cData, IAnimationContext ctx)
Parameters
delta
Vector3The delta to add to the pivot.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
AddPositionDeltaRaw(Vector3, CharData, IAnimatorContext)
Add a raw delta to the position of the character. This delta will ignore the animator's scaling.
public static void AddPositionDeltaRaw(Vector3 delta, CharData cData, IAnimatorContext ctx)
Parameters
delta
Vector3The delta to add to the position of the character.
cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimationContext of the animation.
AddPositionDeltaRaw(Vector3, CharData, IAnimationContext)
Add a raw delta to the position of the character. This delta will ignore the animator's scaling.
public static void AddPositionDeltaRaw(Vector3 delta, CharData cData, IAnimationContext ctx)
Parameters
delta
Vector3The delta to add to the position of the character.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
AddVertexDeltaRaw(int, Vector3, CharData, IAnimatorContext)
Add a raw delta to the vertex at the given index. This delta will ignore the animator's scaling.
public static void AddVertexDeltaRaw(int index, Vector3 delta, CharData cData, IAnimatorContext ctx)
Parameters
index
intIndex of the vertex.
delta
Vector3The delta to add to the vertex.
cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimatorContext of the animation.
AddVertexDeltaRaw(int, Vector3, CharData, IAnimationContext)
Add a raw delta to the vertex at the given index. This delta will ignore the animator's scaling.
public static void AddVertexDeltaRaw(int index, Vector3 delta, CharData cData, IAnimationContext ctx)
Parameters
index
intIndex of the vertex.
delta
Vector3The delta to add to the vertex.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
AnchorToPosition(Vector2, CharData)
Convert an anchor vector to its actual position vector.
public static Vector2 AnchorToPosition(Vector2 anchor, CharData cData)
Parameters
Returns
- Vector2
The position vector.
ClosestPointOnLine(Vector3, Vector3, Vector3)
Get the point on a line closest to the given point.
public static Vector3 ClosestPointOnLine(Vector3 lineStart, Vector3 lineEnd, Vector3 point)
Parameters
lineStart
Vector3lineEnd
Vector3point
Vector3
Returns
- Vector3
GetRawDelta(Vector3, CharData, IAnimatorContext)
Calculate the raw version of the passed in delta, i.e. the one that will ignore the animator's scaling.
public static Vector3 GetRawDelta(Vector3 delta, CharData cData, IAnimatorContext ctx)
Parameters
delta
Vector3The delta.
cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimatorContext of the animation.
Returns
- Vector3
The raw version of the passed in delta, i.e. the one that will ignore the TMPAnimator's scaling.
GetRawDelta(Vector3, CharData, IAnimationContext)
Calculate the raw version of the passed in delta, i.e. the one that will ignore the animator's scaling.
public static Vector3 GetRawDelta(Vector3 delta, CharData cData, IAnimationContext ctx)
Parameters
delta
Vector3The delta.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
Returns
- Vector3
The raw version of the passed in delta, i.e. the one that will ignore the TMPAnimator's scaling.
GetRawPivot(Vector3, CharData, IAnimatorContext)
Calculate the raw version of the passed in pivot position, i.e. the one that will ignore the animator's scaling.
public static Vector3 GetRawPivot(Vector3 position, CharData cData, IAnimatorContext ctx)
Parameters
position
Vector3The position to set the pivot to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimatorContext of the animation.
Returns
- Vector3
The raw version of the passed in pivot position, i.e. the one that will ignore the TMPAnimator's scaling.
GetRawPivot(Vector3, CharData, IAnimationContext)
Calculate the raw version of the passed in pivot position, i.e. the one that will ignore the animator's scaling.
public static Vector3 GetRawPivot(Vector3 position, CharData cData, IAnimationContext ctx)
Parameters
position
Vector3The position to set the pivot to.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
Returns
- Vector3
The raw version of the passed in pivot position, i.e. the one that will ignore the TMPAnimator's scaling.
GetRawPosition(Vector3, CharData, IAnimatorContext)
Calculate the raw version of the passed in character position, i.e. the one that will ignore the animator's scaling.
public static Vector3 GetRawPosition(Vector3 position, CharData cData, IAnimatorContext ctx)
Parameters
position
Vector3The position to set the character to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimatorContext of the animation.
Returns
- Vector3
The raw version of the passed in character position, i.e. the one that will ignore the TMPAnimator's scaling.
GetRawPosition(Vector3, CharData, IAnimationContext)
Calculate the raw version of the passed in character position, i.e. the one that will ignore the animator's scaling.
public static Vector3 GetRawPosition(Vector3 position, CharData cData, IAnimationContext ctx)
Parameters
position
Vector3The position to set the character to.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
Returns
- Vector3
The raw version of the passed in character position, i.e. the one that will ignore the TMPAnimator's scaling.
GetRawVertex(int, Vector3, CharData, IAnimatorContext)
Calculate the raw version of the passed in vertex position, i.e. the one that will ignore the animator's scaling.
public static Vector3 GetRawVertex(int index, Vector3 position, CharData cData, IAnimatorContext ctx)
Parameters
index
intIndex of the vertex.
position
Vector3The position to set the vertex to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimatorContext of the animation.
Returns
- Vector3
The raw version of the passed in vertex position, i.e. the one that will ignore the TMPAnimator's scaling.
GetRawVertex(int, Vector3, CharData, IAnimationContext)
Calculate the raw version of the passed in vertex position, i.e. the one that will ignore the animator's scaling.
public static Vector3 GetRawVertex(int index, Vector3 position, CharData cData, IAnimationContext ctx)
Parameters
index
intIndex of the vertex.
position
Vector3The position to set the vertex to.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
Returns
- Vector3
The raw version of the passed in vertex position, i.e. the one that will ignore the TMPAnimator's scaling.
GetValue(AnimationCurve, WrapMode, float)
Evaluate an UnityEngine.AnimationCurve with different UnityEngine.WrapModes.
public static float GetValue(AnimationCurve curve, WrapMode wrapMode, float time)
Parameters
curve
AnimationCurveThe curve to evaluate.
wrapMode
WrapModeThe UnityEngine.WrapMode to use.
time
floatThe time value.
Returns
- float
The value of the curve at the given time value.
Exceptions
GetWaveOffset(CharData, IAnimationContext, WaveOffsetType)
Get the wave offset to use based on the type
.
To be used with Evaluate(float, float, bool) (and related methods).
public static float GetWaveOffset(CharData cData, IAnimationContext context, AnimationUtility.WaveOffsetType type)
Parameters
cData
CharDataThe character to get the offset for.
context
IAnimationContextThe context of the animation.
type
AnimationUtility.WaveOffsetTypeThe type of the offset.
Returns
- float
The offset for a wave.
Exceptions
InverseScaleVector(Vector3, CharData, IAnimatorContext)
Scale a vector for an animation inversely.
TMPAnimator automatically scales animations; using this method scales the vector in a way that makes it effectively ignore the TMPAnimator's scaling.
public static Vector3 InverseScaleVector(Vector3 vector, CharData cData, IAnimatorContext context)
Parameters
vector
Vector3The vector to scale inversely.
cData
CharDataThe CharData the vector will be applied to.
context
IAnimatorContextThe IAnimatorContext of the animation.
Returns
- Vector3
The inversely scaled vector.
InverseScaleVector(Vector3, CharData, IAnimationContext)
Scale a vector for an animation inversely.
TMPAnimator automatically scales animations; using this method scales the vector in a way that makes it effectively ignore the TMPAnimator's scaling.
public static Vector3 InverseScaleVector(Vector3 vector, CharData cData, IAnimationContext context)
Parameters
vector
Vector3The vector to scale inversely.
cData
CharDataThe CharData the vector will be applied to.
context
IAnimationContextThe IAnimationContext of the animation.
Returns
- Vector3
The inversely scaled vector.
ScaleTextMesh(TMP_Text, float)
Scale a given value to make it uniform between TMPro.TextMeshPro and TMPro.TextMeshProUGUI components.
public static float ScaleTextMesh(TMP_Text text, float value)
Parameters
text
TMP_Textvalue
floatThe value to scale.
Returns
- float
The scaled value.
ScaleVector(Vector3, CharData, IAnimatorContext)
Scale a vector for an animation.
Used by TMPAnimator to automatically scale animations.
public static Vector3 ScaleVector(Vector3 vector, CharData cData, IAnimatorContext context)
Parameters
vector
Vector3The vector to scale.
cData
CharDataThe CharData the vector will applied to.
context
IAnimatorContextThe IAnimatorContext of the animation.
Returns
- Vector3
The scaled vector.
ScaleVector(Vector3, CharData, IAnimationContext)
Scale a vector for an animation.
Makes vectors uniform relative to the size of the text.
Used by TMPAnimator to automatically scale animations.
public static Vector3 ScaleVector(Vector3 vector, CharData cData, IAnimationContext context)
Parameters
vector
Vector3The vector to scale.
cData
CharDataThe CharData the vector will applied to.
context
IAnimationContextThe IAnimatorContext of the animation.
Returns
- Vector3
The scaled vector.
SetPivotRaw(Vector3, CharData, IAnimatorContext)
Set the raw pivot of the character. This position will ignore the animator's scaling.
public static void SetPivotRaw(Vector3 pivot, CharData cData, IAnimatorContext ctx)
Parameters
pivot
Vector3cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimatorContext of the animation.
SetPivotRaw(Vector3, CharData, IAnimationContext)
Set the raw pivot of the character. This position will ignore the animator's scaling.
public static void SetPivotRaw(Vector3 pivot, CharData cData, IAnimationContext ctx)
Parameters
pivot
Vector3cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
SetPositionRaw(Vector3, CharData, IAnimatorContext)
Set the raw position of the character. This position will ignore the animator's scaling.
public static void SetPositionRaw(Vector3 position, CharData cData, IAnimatorContext ctx)
Parameters
position
Vector3The position to set the character to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimatorContext of the animation.
SetPositionRaw(Vector3, CharData, IAnimationContext)
Set the raw position of the character. This position will ignore the animator's scaling.
public static void SetPositionRaw(Vector3 position, CharData cData, IAnimationContext ctx)
Parameters
position
Vector3The position to set the character to.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
SetToCharacter(TMP_Character, TMP_Character, CharData, IAnimationContext)
Set a character's UVs so it will look like another character.
public static void SetToCharacter(TMP_Character newCharacter, TMP_Character originalCharacter, CharData cData, IAnimationContext context)
Parameters
newCharacter
TMP_CharacterThe character to change to.
originalCharacter
TMP_CharacterThe original character of the
cData
.cData
CharDataThe CharData of the character.
context
IAnimationContextThe context of the animation.
SetVertexRaw(int, Vector3, CharData, IAnimatorContext)
Set the raw position of the vertex at the given index. This position will ignore the animator's scaling.
public static void SetVertexRaw(int index, Vector3 position, CharData cData, IAnimatorContext ctx)
Parameters
index
intIndex of the vertex.
position
Vector3The position to set the vertex to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorContextThe IAnimatorContext of the animation.
SetVertexRaw(int, Vector3, CharData, IAnimationContext)
Set the raw position of the vertex at the given index. This position will ignore the animator's scaling.
public static void SetVertexRaw(int index, Vector3 position, CharData cData, IAnimationContext ctx)
Parameters
index
intIndex of the vertex.
position
Vector3The position to set the vertex to.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.