Class TMPAnimator
- Namespace
- TMPEffects.Components
- Assembly
- TMPEffects.dll
Animates the character of a TMPro.TMP_Text component.
[HelpURL("https://tmpeffects.luca3317.dev/docs/tmpanimator.html")]
[ExecuteAlways]
[DisallowMultipleComponent]
[RequireComponent(typeof(TMP_Text))]
public class TMPAnimator : TMPEffectComponent
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourTMPAnimator
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.transformComponent.gameObjectComponent.tagObject.GetInstanceID()Object.GetHashCode()Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
One of the two main components of TMPEffects, along with TMPWriter.
TMPAnimator allows you to apply animations to the characters of a TMPro.TMP_Text component.
There are three types of animations:
You may control when the animations are updated by setting UpdateFrom to Script and calling UpdateAnimations(float).
Fields
ANIMATION_PREFIX
The prefix used for basic animation tags.
public const char ANIMATION_PREFIX = '\0'
Field Value
HIDE_ANIMATION_PREFIX
The prefix used for hide animation tags.
public const char HIDE_ANIMATION_PREFIX = '-'
Field Value
SHOW_ANIMATION_PREFIX
The prefix used for show animation tags.
public const char SHOW_ANIMATION_PREFIX = '+'
Field Value
Properties
AnimateOnStart
Whether the TMPAnimator should automatically begin animating on Start().
public bool AnimateOnStart { get; set; }
Property Value
AnimationsOverride
Whether animations will override each other by default.
public bool AnimationsOverride { get; set; }
Property Value
BasicTags
All basic animation tags parsed by the TMPAnimator.
public ITagCollection BasicTags { get; }
Property Value
Database
The database used to parse animation tags.
public TMPAnimationDatabase Database { get; }
Property Value
HideTags
All hide animation tags parsed by the TMPAnimator.
public ITagCollection HideTags { get; }
Property Value
IsAnimating
Whether the text is currently being animated.
If UpdateFrom is set to Script, this will always evaluate to true.
public bool IsAnimating { get; }
Property Value
ShowTags
All show animation tags parsed by the TMPAnimator.
public ITagCollection ShowTags { get; }
Property Value
Tags
All tags parsed by the TMPAnimator.
public ITagCollection Tags { get; }
Property Value
UpdateFrom
Where the animations are currently being updated from.
public UpdateFrom UpdateFrom { get; }
Property Value
Methods
IsExcluded(char, TMPAnimationType)
Whether the character is excluded from animations of the given type.
public bool IsExcluded(char c, TMPAnimationType type)
Parameters
c
charThe character to check.
type
TMPAnimationTypeThe type of animation to check against.
Returns
- bool
Whether the character is excluded from animations of the given type.
Exceptions
- ArgumentException
If an invalid TMPAnimationType is passed in.
IsExcludedBasic(char)
Check whether the given character is excluded from basic animations.
public bool IsExcludedBasic(char c)
Parameters
c
charThe character to check.
Returns
- bool
Whether the character is excluded from basic animations.
IsExcludedHide(char)
Check whether the given character is excluded from hide animations.
public bool IsExcludedHide(char c)
Parameters
c
charThe character to check.
Returns
- bool
Whether the character is excluded from hide animations.
IsExcludedShow(char)
Check whether the given character is excluded from show animations.
public bool IsExcludedShow(char c)
Parameters
c
charThe character to check.
Returns
- bool
Whether the character is excluded from show animations.
ResetAnimations()
Reset all visible characters to their initial, unanimated state.
public void ResetAnimations()
ResetTime()
Reset the time of the animator.
public void ResetTime()
SetDatabase(TMPAnimationDatabase)
Set the database that will be used to parse animation tags.
public void SetDatabase(TMPAnimationDatabase database)
Parameters
database
TMPAnimationDatabaseThe database that will be used to parse animation tags.
SetDefaultHideString(string)
public void SetDefaultHideString(string str)
Parameters
str
string
SetDefaultShowString(string)
public void SetDefaultShowString(string str)
Parameters
str
string
SetExcludedBasicCharacters(string, bool?)
Set the excluded character for basic animations, meaning characters that will not be animated by basic animations.
public void SetExcludedBasicCharacters(string str, bool? excludePunctuation = null)
Parameters
str
stringThe excluded characters, as string. The string will be evaluated character-wise.
excludePunctuation
bool?Whether punctuation is excluded.
SetExcludedCharacters(TMPAnimationType, string, bool?)
Set the excluded character for animations of the given type, meaning characters that will not be animated by that type of animations.
public void SetExcludedCharacters(TMPAnimationType type, string str, bool? excludePunctuation = null)
Parameters
type
TMPAnimationTypestr
stringThe excluded characters, as string. The string will be evaluated character-wise.
excludePunctuation
bool?Whether punctuation is excluded.
Exceptions
- ArgumentException
If an invalid TMPAnimationType is passed in.
SetExcludedHideCharacters(string, bool?)
Set the excluded character for hide animations, meaning characters that will not be animated by hide animations.
public void SetExcludedHideCharacters(string str, bool? excludePunctuation = null)
Parameters
str
stringThe excluded characters, as string. The string will be evaluated character-wise.
excludePunctuation
bool?Whether punctuation is excluded.
SetExcludedShowCharacters(string, bool?)
Set the excluded character for show animations, meaning characters that will not be animated by show animations.
public void SetExcludedShowCharacters(string str, bool? excludePunctuation = null)
Parameters
str
stringThe excluded characters, as string. The string will be evaluated character-wise.
excludePunctuation
bool?Whether punctuation is excluded.
SetUpdateFrom(UpdateFrom)
Set where the animations should be updated from.
public void SetUpdateFrom(UpdateFrom updateFrom)
Parameters
updateFrom
UpdateFromWhere the animations are updated from.
StartAnimating()
Start animating.
You should only call this if UpdateFrom is NOT set to Script,
otherwise this will output a warning and return.
public void StartAnimating()
StopAnimating()
Stop animating.
You should only call this if UpdateFrom is NOT set to Script,
otherwise this will output a warning and return.
public void StopAnimating()
UpdateAnimations(float)
Update the current animations.
You should only call this if UpdateFrom is set to Script,
otherwise this will output a warning and return.
public void UpdateAnimations(float deltaTime)
Parameters
deltaTime
float