Creating Effects (C#)
Code
using Animatext; //Add "Animatext" namespace.
using Animatext.Effects; //Add "Animatext.Effects" namespace.
using UnityEngine;
public class ExampleC01 : MonoBehaviour
{
private void Start()
{
//Step 1 - Create the effect.
TCBasicA01 preset = ScriptableObject.CreateInstance<TCBasicA01>();
preset.tag = string.Empty;
preset.startInterval = 0;
preset.reverse = false;
preset.loopCount = 0;
preset.loopInterval = 0;
preset.loopBackInterval = 0;
preset.pingpongLoop = false;
preset.continuousLoop = false;
preset.interval = 0.5f;
preset.singleTime = 1;
preset.sortType = SortType.FrontToBack;
preset.position = new Vector2(0, 100);
preset.easingType = EasingType.Linear;
preset.fadeMode = ColorMode.Multiply;
preset.fadeRange = new FloatRange(0, 0.5f);
//You can also use the "Resources.Load" method to load created presets.
Effect effect = new Effect(preset);
//effect.autoStart = true;
//effect.autoPlay = true;
//effect.autoEnd = true;
//effect.autoStop = true;
//effect.refreshMode = RefreshMode.Start;
//Step 2 - Add the effect to the Animatext component.
BaseAnimatext animatext = gameObject.AddComponent<BaseAnimatext>();
//Set the text first and then add the effect.
//animatext.text = "Animatext";
//animatext.effects.Add(effect);
//animatext.Refresh(true);
//Add the effect first and then set the text. All effects will be automatically refreshed after setting the text.
animatext.effects.Add(effect);
animatext.SetText("Animatext");
}
}