UxrInterpolator.InterpolateText Method (Single, Boolean, String, Object[])

Interpolates text using a typewriter effect

Namespace: UltimateXR.Animation.Interpolation
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static string InterpolateText(
	float t,
	bool isForUnityTextUI,
	string formatString,
	params Object[] formatStringArgs
)

Parameters

 

t
Type: System.Single
Interpolation t between range [0.0, 1.0]
isForUnityTextUI
Type: System.Boolean
If true, uses the rich text properties of the Unity UI text component to add invisible characters during interpolation. These invisible characters will help keeping the final text layout so that there are no line wraps or line jumps during the interpolation.
formatString
Type: System.String
The format string (what would be the first parameter of Format(String, Object[]))
formatStringArgs
Type: System.Object[]
Start/end pairs that will be interpolated and fed into Format(String, Object[]). These should be sequential pairs of values of the same type that represent the start value and the end value. For instance format could be “{0}:{1}” and args could be startArg0, endArg0, startArg1, endArg1. This will print 2 interpolated values (Arg0 and Arg1) whose start and end values are defined by the other 4 parameters.

The interpolation can detect numerical values (int/float) and use numerical interpolation instead of raw string interpolation. This can be useful for effects as seen in the examples.

Return Value

Type: String
Interpolated string

Examples

Simple typewriter effect to write a sentence starting from empty: (t goes from 0.0 to 1.0)

InterpolateText(t, true, "{0}", string.Empty, "Welcome to the Matrix!");

Examples

Using format string args to create an increasing score animation. The numerical values are interpolated instead of using a typewriter effect. (t goes from 0.0 to 1.0).

int finalScore = 999999;
InterpolateText(t, true, "Final score: {0:000000}", 0, finalScore);

See Also

Reference

UxrInterpolator Class
InterpolateText Overload
UltimateXR.Animation.Interpolation Namespace