Table of Contents

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 Vector3

The delta to add to the pivot.

cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 Vector3

The delta to add to the pivot.

cData CharData

The CharData to act on.

ctx IAnimationContext

The 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 Vector3

The delta to add to the position of the character.

cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 Vector3

The delta to add to the position of the character.

cData CharData

The CharData to act on.

ctx IAnimationContext

The 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 int

Index of the vertex.

delta Vector3

The delta to add to the vertex.

cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 int

Index of the vertex.

delta Vector3

The delta to add to the vertex.

cData CharData

The CharData to act on.

ctx IAnimationContext

The 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

anchor Vector2

The anchor to convert.

cData CharData

The CharData the anchor applies to.

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 Vector3
lineEnd Vector3
point 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 Vector3

The delta.

cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 Vector3

The delta.

cData CharData

The CharData to act on.

ctx IAnimationContext

The 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 Vector3

The position to set the pivot to.

cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 Vector3

The position to set the pivot to.

cData CharData

The CharData to act on.

ctx IAnimationContext

The 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 Vector3

The position to set the character to.

cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 Vector3

The position to set the character to.

cData CharData

The CharData to act on.

ctx IAnimationContext

The 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 int

Index of the vertex.

position Vector3

The position to set the vertex to.

cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 int

Index of the vertex.

position Vector3

The position to set the vertex to.

cData CharData

The CharData to act on.

ctx IAnimationContext

The 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 AnimationCurve

The curve to evaluate.

wrapMode WrapMode

The UnityEngine.WrapMode to use.

time float

The time value.

Returns

float

The value of the curve at the given time value.

Exceptions

ArgumentException

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 CharData

The character to get the offset for.

context IAnimationContext

The context of the animation.

type AnimationUtility.WaveOffsetType

The type of the offset.

Returns

float

The offset for a wave.

Exceptions

ArgumentException

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 Vector3

The vector to scale inversely.

cData CharData

The CharData the vector will be applied to.

context IAnimatorContext

The 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 Vector3

The vector to scale inversely.

cData CharData

The CharData the vector will be applied to.

context IAnimationContext

The 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_Text
value float

The 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 Vector3

The vector to scale.

cData CharData

The CharData the vector will applied to.

context IAnimatorContext

The 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 Vector3

The vector to scale.

cData CharData

The CharData the vector will applied to.

context IAnimationContext

The 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 Vector3
cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 Vector3
cData CharData

The CharData to act on.

ctx IAnimationContext

The 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 Vector3

The position to set the character to.

cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 Vector3

The position to set the character to.

cData CharData

The CharData to act on.

ctx IAnimationContext

The 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_Character

The character to change to.

originalCharacter TMP_Character

The original character of the cData.

cData CharData

The CharData of the character.

context IAnimationContext

The 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 int

Index of the vertex.

position Vector3

The position to set the vertex to.

cData CharData

The CharData to act on.

ctx IAnimatorContext

The 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 int

Index of the vertex.

position Vector3

The position to set the vertex to.

cData CharData

The CharData to act on.

ctx IAnimationContext

The IAnimationContext of the animation.