Table of Contents

IAnimationContext

An instance of the IAnimationContext type serves as the context for all animations.

Properties

IAnimationContext exposes various properties that will be useful for your animations:

  • CustomData: The custom data object created in GetNewCustomData (see Creating Animations).

  • SegmentData: Contains information about the animation segment the current character belongs to.

    • StartIndex: The first index of the segment within the containing text
    • Length: The lenght of the segment
    • FirstVisibleIndex: The index of the first visible character (i.e. non-whitespace character)
    • LastVisibleIndex: The index of the last visible character (i.e. non-whitespace character)
    • FirstAnimationIndex: The index of the first character will actually be animated (i.e. not whitespace, not excluded by TMPAnimator)
    • LastAnimationIndex: The index of the last character will actually be animated (i.e. not whitespace, not excluded by TMPAnimator)
    • Max: The maximum vertex positions of text in this segment
    • Min: The minimum vertex positions of text in this segment
    • SegmentIndexOf(CharData): Get the index within this segment for the passed in CharData

  • State: Exposes multiple readonly properties about the current state of the CharData (with previous animations already applied). Generally, to be used with the late tag parameters (see Getting started with TMPAnimator).

    • CalculateVertexPositions(): Calculate the current vertex positions. Results can be read from BL_Result, TL_Result, TR_Result, BR_Result.

  • Finished(int), Finished(CharData): Check whether the given CharData is done animating. To be used with show and hide animations (see Creating show / hide animations).

  • FinishAnimation(CharData): Finish the animation for the given CharData. To be used with show and hide animations (see Creating show / hide animations).

  • AnimatorContext: The IAnimatorContext exposes properties about the animator state.

    • PassedTime: The time that has passed since the animator began animating. Generally speaking, you should use this as the time value for basic animations
    • DeltaTime: The current delta time used by the animator to update the animations.
    • UseScaledTime: Whether the animator uses scaled time (=> whether PassedTime is scaled)
    • ScaleAnimations: Whether the animator scales the animation. Used by various AnimationUtility methods.
    • StateTime(CharData): How long the given CharData has been in its current visibility state for. Generally speaking, you should use this as the time value for show and hide animations
    • VisibleTime(CharData): How long the given CharData has been visible for. Can use this alternatively to PassedTime for basic animations