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
lineStartVector3lineEndVector3pointVector3
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
minfloatmaxfloattypeTMPParameterTypes.OffsetTypesegmentDataITMPSegmentDataanimatorDataIAnimatorDataProviderignoreAnimatorScalingbool
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
cDataCharDatacontextIAnimatorDataProviderproviderITMPOffsetProviderignoreScalingboolignoreSegmentLenghtbool
Returns
GetOffset(CharData, IAnimationContext, ITMPOffsetProvider, bool, bool)
public static float GetOffset(CharData cData, IAnimationContext context, ITMPOffsetProvider provider, bool ignoreScaling = false, bool ignoreSegmentLenght = false)
Parameters
cDataCharDatacontextIAnimationContextproviderITMPOffsetProviderignoreScalingboolignoreSegmentLenghtbool
Returns
GetOffset(OffsetType, CharData, ITMPSegmentData, IAnimatorDataProvider, bool)
public static float GetOffset(TMPParameterTypes.OffsetType type, CharData cData, ITMPSegmentData segmentData, IAnimatorDataProvider animatorData, bool ignoreAnimatorScaling = false)
Parameters
typeTMPParameterTypes.OffsetTypecDataCharDatasegmentDataITMPSegmentDataanimatorDataIAnimatorDataProviderignoreAnimatorScalingbool
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
deltaVector3The delta.
cDataCharDataThe CharData to act on.
ctxIAnimatorDataProviderThe 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
deltaVector3The delta.
cDataCharDataThe CharData to act on.
ctxIAnimationContextThe 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
positionVector3The position to set the pivot to.
cDataCharDataThe CharData to act on.
ctxIAnimatorDataProviderThe 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
positionVector3The position to set the pivot to.
cDataCharDataThe CharData to act on.
ctxIAnimationContextThe 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
positionVector3The position to set the character to.
cDataCharDataThe CharData to act on.
ctxIAnimatorDataProviderThe 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
positionVector3The position to set the character to.
cDataCharDataThe CharData to act on.
ctxIAnimationContextThe 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
indexintIndex of the vertex.
positionVector3The position to set the vertex to.
cDataCharDataThe CharData to act on.
ctxIAnimatorDataProviderThe 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
indexintIndex of the vertex.
positionVector3The position to set the vertex to.
cDataCharDataThe CharData to act on.
ctxIAnimationContextThe 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
curveAnimationCurvewrapModeTMPAnimationUtility.TMPWrapModetimefloat
Returns
GetValue(AnimationCurve, WrapMode, float)
Evaluate an AnimationCurve with different WrapModes.
public static float GetValue(AnimationCurve curve, WrapMode wrapMode, float time)
Parameters
curveAnimationCurveThe curve to evaluate.
wrapModeWrapModeThe WrapMode to use.
timefloatThe 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
vectorVector3isTMProUGUIboolscaleAnimationsboolscaleUniformlyboolpointSizefloatfontSizefloat
Returns
- Vector3
IgnoreScaling(Vector3, CharData, IAnimatorDataProvider)
public static Vector3 IgnoreScaling(Vector3 vector, CharData cData, IAnimatorDataProvider context)
Parameters
vectorVector3cDataCharDatacontextIAnimatorDataProvider
Returns
- Vector3
IgnoreScaling(Vector3, CharData, IAnimationContext)
public static Vector3 IgnoreScaling(Vector3 vector, CharData cData, IAnimationContext context)
Parameters
vectorVector3cDataCharDatacontextIAnimationContext
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
vectorVector3The vector to scale inversely.
cDataCharDataThe CharData the vector will be applied to.
contextIAnimatorDataProviderThe 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
vectorVector3The vector to scale inversely.
cDataCharDataThe CharData the vector will be applied to.
contextIAnimationContextThe 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
eulerAnglesVector3
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
ctxIAnimatorDataProvidervaluefloat
Returns
ScaleTextMesh(IAnimationContext, float)
public static float ScaleTextMesh(IAnimationContext ctx, float value)
Parameters
ctxIAnimationContextvaluefloat
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
textTMP_TextvaluefloatThe 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
vectorVector3isTMProUGUIboolscaleAnimationsboolscaleUniformlyboolpointSizefloatfontSizefloat
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
vectorVector3The vector to scale.
cDataCharDataThe CharData the vector will applied to.
contextIAnimatorDataProviderThe 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
vectorVector3The vector to scale.
cDataCharDataThe CharData the vector will applied to.
contextIAnimationContextThe 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
positionVector3The position to set the character to.
cDataCharDataThe CharData to act on.
ctxIAnimatorDataProviderThe 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
positionVector3The position to set the character to.
cDataCharDataThe CharData to act on.
ctxIAnimationContextThe 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
newCharacterTMP_CharacterThe character to change to.
originalCharacterTMP_CharacterThe original character of the
cData.cDataCharDataThe CharData of the character.
contextIAnimationContextThe 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
indexintIndex of the vertex.
positionVector3The position to set the vertex to.
cDataCharDataThe CharData to act on.
ctxIAnimatorDataProviderThe 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
indexintIndex of the vertex.
positionVector3The position to set the vertex to.
cDataCharDataThe CharData to act on.
ctxIAnimationContextThe IAnimationContext of the animation.
ToWrapMode(TMPWrapMode)
public static WrapMode ToWrapMode(this TMPAnimationUtility.TMPWrapMode wrapMode)
Parameters
wrapModeTMPAnimationUtility.TMPWrapMode
Returns
- WrapMode