Table of Contents

Class TMPAnimationUtility

Utility methods for animations.

public static class TMPAnimationUtility
Inheritance
TMPAnimationUtility
Inherited Members

Methods

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

GetMinMaxOffset(out float, out float, OffsetType, ITMPSegmentData, IAnimatorDataProvider, bool)

public static void GetMinMaxOffset(out float min, out float max, TMPParameterTypes.OffsetType type, ITMPSegmentData segmentData, IAnimatorDataProvider animatorData, bool ignoreAnimatorScaling = false)

Parameters

min float
max float
type TMPParameterTypes.OffsetType
segmentData ITMPSegmentData
animatorData IAnimatorDataProvider
ignoreAnimatorScaling bool

GetMockedSegment(int, IList<CharData>)

public static ITMPSegmentData GetMockedSegment(int len, IList<CharData> cData)

Parameters

len int
cData IList<CharData>

Returns

ITMPSegmentData

GetOffset(CharData, IAnimatorDataProvider, ITMPOffsetProvider, bool, bool)

public static float GetOffset(CharData cData, IAnimatorDataProvider context, ITMPOffsetProvider provider, bool ignoreScaling = false, bool ignoreSegmentLenght = false)

Parameters

cData CharData
context IAnimatorDataProvider
provider ITMPOffsetProvider
ignoreScaling bool
ignoreSegmentLenght bool

Returns

float

GetOffset(CharData, IAnimationContext, ITMPOffsetProvider, bool, bool)

public static float GetOffset(CharData cData, IAnimationContext context, ITMPOffsetProvider provider, bool ignoreScaling = false, bool ignoreSegmentLenght = false)

Parameters

cData CharData
context IAnimationContext
provider ITMPOffsetProvider
ignoreScaling bool
ignoreSegmentLenght bool

Returns

float

GetOffset(OffsetType, CharData, ITMPSegmentData, IAnimatorDataProvider, bool)

public static float GetOffset(TMPParameterTypes.OffsetType type, CharData cData, ITMPSegmentData segmentData, IAnimatorDataProvider animatorData, bool ignoreAnimatorScaling = false)

Parameters

type TMPParameterTypes.OffsetType
cData CharData
segmentData ITMPSegmentData
animatorData IAnimatorDataProvider
ignoreAnimatorScaling bool

Returns

float

GetRawDelta(Vector3, CharData, IAnimatorDataProvider)

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, IAnimatorDataProvider ctx)

Parameters

delta Vector3

The delta.

cData CharData

The CharData to act on.

ctx IAnimatorDataProvider

The IAnimatorDataProvider 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, IAnimatorDataProvider)

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, IAnimatorDataProvider ctx)

Parameters

position Vector3

The position to set the pivot to.

cData CharData

The CharData to act on.

ctx IAnimatorDataProvider

The IAnimatorDataProvider 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, IAnimatorDataProvider)

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, IAnimatorDataProvider ctx)

Parameters

position Vector3

The position to set the character to.

cData CharData

The CharData to act on.

ctx IAnimatorDataProvider

The IAnimatorDataProvider 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, IAnimatorDataProvider)

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, IAnimatorDataProvider 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 IAnimatorDataProvider

The IAnimatorDataProvider 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, TMPWrapMode, float)

public static float GetValue(AnimationCurve curve, TMPAnimationUtility.TMPWrapMode wrapMode, float time)

Parameters

curve AnimationCurve
wrapMode TMPAnimationUtility.TMPWrapMode
time float

Returns

float

GetValue(AnimationCurve, WrapMode, float)

Evaluate an AnimationCurve with different WrapModes.

public static float GetValue(AnimationCurve curve, WrapMode wrapMode, float time)

Parameters

curve AnimationCurve

The curve to evaluate.

wrapMode WrapMode

The WrapMode to use.

time float

The time value.

Returns

float

The value of the curve at the given time value.

Exceptions

ArgumentException

IgnoreScaling(Vector3, bool, bool, bool, float, float)

public static Vector3 IgnoreScaling(Vector3 vector, bool isTMProUGUI, bool scaleAnimations, bool scaleUniformly, float pointSize, float fontSize)

Parameters

vector Vector3
isTMProUGUI bool
scaleAnimations bool
scaleUniformly bool
pointSize float
fontSize float

Returns

Vector3

IgnoreScaling(Vector3, CharData, IAnimatorDataProvider)

public static Vector3 IgnoreScaling(Vector3 vector, CharData cData, IAnimatorDataProvider context)

Parameters

vector Vector3
cData CharData
context IAnimatorDataProvider

Returns

Vector3

IgnoreScaling(Vector3, CharData, IAnimationContext)

public static Vector3 IgnoreScaling(Vector3 vector, CharData cData, IAnimationContext context)

Parameters

vector Vector3
cData CharData
context IAnimationContext

Returns

Vector3

InverseScaleVector(Vector3, CharData, IAnimatorDataProvider)

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, IAnimatorDataProvider context)

Parameters

vector Vector3

The vector to scale inversely.

cData CharData

The CharData the vector will be applied to.

context IAnimatorDataProvider

The IAnimatorDataProvider 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.

NormalizeEulerAngles(Vector3)

Normalizes euler angles so that each component is within [-180, 180].

public static Vector3 NormalizeEulerAngles(Vector3 eulerAngles)

Parameters

eulerAngles Vector3

Returns

Vector3

The normalized angles.

ScaleTextMesh(bool, float)

public static float ScaleTextMesh(bool isTMProUGUI, float value)

Parameters

isTMProUGUI bool
value float

Returns

float

ScaleTextMesh(IAnimatorDataProvider, float)

public static float ScaleTextMesh(IAnimatorDataProvider ctx, float value)

Parameters

ctx IAnimatorDataProvider
value float

Returns

float

ScaleTextMesh(IAnimationContext, float)

public static float ScaleTextMesh(IAnimationContext ctx, float value)

Parameters

ctx IAnimationContext
value float

Returns

float

ScaleTextMesh(TMP_Text, float)

Scale a given value to make it uniform between TextMeshPro and 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, bool, bool, bool, float, float)

public static Vector3 ScaleVector(Vector3 vector, bool isTMProUGUI, bool scaleAnimations, bool scaleUniformly, float pointSize, float fontSize)

Parameters

vector Vector3
isTMProUGUI bool
scaleAnimations bool
scaleUniformly bool
pointSize float
fontSize float

Returns

Vector3

ScaleVector(Vector3, CharData, IAnimatorDataProvider)

Scale a vector for an animation.
Used by TMPAnimator to automatically scale animations.

public static Vector3 ScaleVector(Vector3 vector, CharData cData, IAnimatorDataProvider context)

Parameters

vector Vector3

The vector to scale.

cData CharData

The CharData the vector will applied to.

context IAnimatorDataProvider

The IAnimatorDataProvider 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 IAnimationContext of the animation.

Returns

Vector3

The scaled vector.

SetPositionRaw(Vector3, CharData, IAnimatorDataProvider)

Set the raw position of the character. This position will ignore the animator's scaling.

public static void SetPositionRaw(Vector3 position, CharData cData, IAnimatorDataProvider ctx)

Parameters

position Vector3

The position to set the character to.

cData CharData

The CharData to act on.

ctx IAnimatorDataProvider

The IAnimatorDataProvider 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, IAnimatorDataProvider)

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, IAnimatorDataProvider 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 IAnimatorDataProvider

The IAnimatorDataProvider 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.

ToWrapMode(TMPWrapMode)

public static WrapMode ToWrapMode(this TMPAnimationUtility.TMPWrapMode wrapMode)

Parameters

wrapMode TMPAnimationUtility.TMPWrapMode

Returns

WrapMode