Class TMPAnimationUtility
- Namespace
- TMPEffects.TMPAnimations
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
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
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
floatmax
floattype
TMPParameterTypes.OffsetTypesegmentData
ITMPSegmentDataanimatorData
IAnimatorDataProviderignoreAnimatorScaling
bool
GetMockedSegment(int, IList<CharData>)
public static ITMPSegmentData GetMockedSegment(int len, IList<CharData> cData)
Parameters
Returns
GetOffset(CharData, IAnimatorDataProvider, ITMPOffsetProvider, bool, bool)
public static float GetOffset(CharData cData, IAnimatorDataProvider context, ITMPOffsetProvider provider, bool ignoreScaling = false, bool ignoreSegmentLenght = false)
Parameters
cData
CharDatacontext
IAnimatorDataProviderprovider
ITMPOffsetProviderignoreScaling
boolignoreSegmentLenght
bool
Returns
GetOffset(CharData, IAnimationContext, ITMPOffsetProvider, bool, bool)
public static float GetOffset(CharData cData, IAnimationContext context, ITMPOffsetProvider provider, bool ignoreScaling = false, bool ignoreSegmentLenght = false)
Parameters
cData
CharDatacontext
IAnimationContextprovider
ITMPOffsetProviderignoreScaling
boolignoreSegmentLenght
bool
Returns
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.OffsetTypecData
CharDatasegmentData
ITMPSegmentDataanimatorData
IAnimatorDataProviderignoreAnimatorScaling
bool
Returns
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
Vector3The delta.
cData
CharDataThe CharData to act on.
ctx
IAnimatorDataProviderThe 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
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, 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
Vector3The position to set the pivot to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorDataProviderThe 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
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, 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
Vector3The position to set the character to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorDataProviderThe 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
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, 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
intIndex of the vertex.
position
Vector3The position to set the vertex to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorDataProviderThe 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
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, TMPWrapMode, float)
public static float GetValue(AnimationCurve curve, TMPAnimationUtility.TMPWrapMode wrapMode, float time)
Parameters
curve
AnimationCurvewrapMode
TMPAnimationUtility.TMPWrapModetime
float
Returns
GetValue(AnimationCurve, WrapMode, float)
Evaluate an AnimationCurve with different WrapModes.
public static float GetValue(AnimationCurve curve, WrapMode wrapMode, float time)
Parameters
curve
AnimationCurveThe curve to evaluate.
wrapMode
WrapModeThe WrapMode to use.
time
floatThe time value.
Returns
- float
The value of the curve at the given time value.
Exceptions
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
Vector3isTMProUGUI
boolscaleAnimations
boolscaleUniformly
boolpointSize
floatfontSize
float
Returns
- Vector3
IgnoreScaling(Vector3, CharData, IAnimatorDataProvider)
public static Vector3 IgnoreScaling(Vector3 vector, CharData cData, IAnimatorDataProvider context)
Parameters
vector
Vector3cData
CharDatacontext
IAnimatorDataProvider
Returns
- Vector3
IgnoreScaling(Vector3, CharData, IAnimationContext)
public static Vector3 IgnoreScaling(Vector3 vector, CharData cData, IAnimationContext context)
Parameters
vector
Vector3cData
CharDatacontext
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
Vector3The vector to scale inversely.
cData
CharDataThe CharData the vector will be applied to.
context
IAnimatorDataProviderThe 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
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.
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
Returns
ScaleTextMesh(IAnimatorDataProvider, float)
public static float ScaleTextMesh(IAnimatorDataProvider ctx, float value)
Parameters
ctx
IAnimatorDataProvidervalue
float
Returns
ScaleTextMesh(IAnimationContext, float)
public static float ScaleTextMesh(IAnimationContext ctx, float value)
Parameters
ctx
IAnimationContextvalue
float
Returns
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_Textvalue
floatThe 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
Vector3isTMProUGUI
boolscaleAnimations
boolscaleUniformly
boolpointSize
floatfontSize
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
Vector3The vector to scale.
cData
CharDataThe CharData the vector will applied to.
context
IAnimatorDataProviderThe 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
Vector3The vector to scale.
cData
CharDataThe CharData the vector will applied to.
context
IAnimationContextThe 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
Vector3The position to set the character to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorDataProviderThe 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
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, 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
intIndex of the vertex.
position
Vector3The position to set the vertex to.
cData
CharDataThe CharData to act on.
ctx
IAnimatorDataProviderThe 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
intIndex of the vertex.
position
Vector3The position to set the vertex to.
cData
CharDataThe CharData to act on.
ctx
IAnimationContextThe IAnimationContext of the animation.
ToWrapMode(TMPWrapMode)
public static WrapMode ToWrapMode(this TMPAnimationUtility.TMPWrapMode wrapMode)
Parameters
wrapMode
TMPAnimationUtility.TMPWrapMode
Returns
- WrapMode