The HBTextAnimator component allows you to create sequential animation steps for HB_TEXTBlock objects.
Setup
- Select an
HB_TEXTBlock GameObject. - Add the
HBTextAnimator component.
Animation Structure
Animations consist of one or more steps played sequentially. Each step has a Name, Duration, Delay, and Ease Curve.
Available Effects per Step
- Typewriter: Reveals text character by character.
- Fade: Transitions from
From alpha to To alpha. - Color Lerp: Transitions from
From color to To color. - Scale: Transitions from
From scale (Vector3) to To scale. - Slide: Slides in from an
Offset (Vector2). - Shake: Random offset with decaying
Intensity. - Gradient Angle: Animates
Start angle to End angle. - Outline Pulse: Animates
From width to To width. - Shadow Animate: Animates
From offset (Vector2) to To offset. - Font Size: Animates
From size to To size. - Letter Spacing: Animates
From spacing to To spacing.
Editor Preview
Use the Preview button in the Inspector to test animations without entering Play Mode. A progress bar shows the current step.
using SkiaSharp.Unity.HB;
using UnityEngine;
public class AnimatorExample : MonoBehaviour {
[SerializeField] HBTextAnimator animator;
void Start() {
// Auto-play is on by default, or call manually:
animator.Play();
animator.onStepComplete.AddListener(stepIndex => {
Debug.Log("Step " + stepIndex + " completed");
});
animator.onComplete.AddListener(() => {
Debug.Log("All steps completed");
});
}
public void StopAnimation() {
animator.Stop(); // Restores original state
}
}