Table of Contents

Class ReadOnlyAnimatorContext

To be used with TMPAnimator.
Contains readonly context data of the respective TMPAnimator.

[Serializable]
public class ReadOnlyAnimatorContext : IAnimatorContext, IAnimatorDataProvider, ICharacterTimingsProvider, IAnimatorTimingsProvider
Inheritance
ReadOnlyAnimatorContext
Implements
Inherited Members

Constructors

ReadOnlyAnimatorContext(IAnimatorContext)

public ReadOnlyAnimatorContext(IAnimatorContext context)

Parameters

context IAnimatorContext

ReadOnlyAnimatorContext(TMPAnimator, bool, bool, bool, Func<int, float>, Func<int, float>)

public ReadOnlyAnimatorContext(TMPAnimator animator, bool scaleAnimations, bool useScaledTime, bool scaleUniformly, Func<int, float> getVisibleTime, Func<int, float> getStateTime)

Parameters

animator TMPAnimator
scaleAnimations bool
useScaledTime bool
scaleUniformly bool
getVisibleTime Func<int, float>
getStateTime Func<int, float>

Properties

Animator

The animating TMPAnimator.

public TMPAnimator Animator { get; }

Property Value

TMPAnimator

DeltaTime

The current delta time (=> time since last animation update).

public float DeltaTime { get; }

Property Value

float

Modifiers

The current state of the CharData, with the previous animations applied.


A typical exemplary use case would be if you want an animation to enforce a character to be at a specific position, regardless of previously applied animations, you can reset the position of these Modifiers to undo previous changes.
Another example would be if your animation requires the actual position of the character, that takes into account transformations made by previously applied animations, you can do so using Modifiers.CalculateVertexPositions.

public CharDataModifiers Modifiers { get; }

Property Value

CharDataModifiers

PassedTime

The time that has passed since the animator began animating.

public float PassedTime { get; }

Property Value

float

ScaleAnimations

Whether animations are scaled.

public bool ScaleAnimations { get; }

Property Value

bool

ScaleUniformly

Whether to scale animations uniformly (based on the default font size of the animator) or on a per character basis.
Ignored if ScaleAnimations is false.

public bool ScaleUniformly { get; }

Property Value

bool

UseScaledTime

Whether animations use scaled time.

public bool UseScaledTime { get; }

Property Value

bool

Methods

StateTime(int)

Check how long the CharData at the given index has been in its current VisibilityState.
Generally, to be used with show and hide animations.

public float StateTime(int index)

Parameters

index int

The index of the character to check.

Returns

float

How long the CharData at the given index has been in its current VisibilityState.

StateTime(CharData)

Check how long the passed CharData has been in its current VisibilityState.
Generally, to be used with show and hide animations.

public float StateTime(CharData cData)

Parameters

cData CharData

The character to check.

Returns

float

How long the passed CharData has been in its current VisibilityState.

VisibleTime(int)

Check how long the CharData at the given index has been visible.

public float VisibleTime(int index)

Parameters

index int

Returns

float

How long the CharData at the given index has been visible.

VisibleTime(CharData)

Check how long the passed CharData has been visible.

public float VisibleTime(CharData cData)

Parameters

cData CharData

The character to check.

Returns

float

How long the passed CharData has been visible.