Animation
Spinner
A flexible loading spinner animation
Overview
Spinner is a animation component used for creating loading indicators. It supports radial and directional fill animations and automatically animates when enabled. Depending on the selected style, it can rotate continuously or play a smooth ping pong fill animation.
Properties
| Name | Type | Description |
|---|---|---|
spinnerStyle | SpinnerStyle | Controls the animation mode: Radial, Horizontal, or Vertical |
rotationSpeed | float | Speed of rotation or fill progression |
minFillAmount | float | Minimum fill amount used in radial animation |
maxFillAmount | float | Maximum fill amount used in radial animation |
spinnerImage | Image | Reference to the Image used for the spinner |
Public Methods
| Name | Parameters | Description |
|---|---|---|
StartSpinning() | None | Starts the spinning animation |
StopSpinning() | None | Stops the spinning animation |
SetSpinnerStyle(style) | SpinnerStyle style | Updates the current style and applies configuration |
Spinner Styles
| Style | Description |
|---|---|
Radial | Classic circular loading animation using rotation and fill expansion |
Horizontal | Ping pong fill animation moving left and right |
Vertical | Ping pong fill animation moving bottom to top |
Code Example
using UnityEngine;
using Evo.UI;
public class SpinnerExample : MonoBehaviour
{
public Spinner spinner;
void YourMethod()
{
// Set style
spinner.SetSpinnerStyle(Spinner.SpinnerStyle.Radial);
// Adjust speed and fill behavior
spinner.rotationSpeed = 2f;
spinner.minFillAmount = 0.2f;
spinner.maxFillAmount = 0.9f;
// Start or stop spinning
spinner.StartSpinning();
spinner.StopSpinning();
}
}