Table of Contents

Class ModularSpinner

Namespace
Fallencake.UI
Assembly
Fallencake.UI.dll

Configurable spinner control that delegates movement to a strategy handler and exposes a rich set of options for rotation geometry and behavior.

public class ModularSpinner : UIBehaviour, ISpinner
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
UIBehaviour
ModularSpinner
Implements

Remarks

Uses a pluggable ISpinnerHandler implementation (e.g., Elliptical or Axial) selected by SpinningType to animate elements inside rotationArea. Provides utility methods to initialize from code and control play state via Spin()/Stop().

Properties

ElementsOffset

Spacing factor between elements along the path.

public float ElementsOffset { get; set; }

Property Value

float

elementStartPosition

Starting positions of elements along the path.

public ElementStartPosition elementStartPosition { get; }

Property Value

ElementStartPosition

elements

The transforms of individual spinning elements.

public List<RectTransform> elements { get; }

Property Value

List<RectTransform>

facingDirection

Initial facing direction for elements.

public FacingDirection facingDirection { get; }

Property Value

FacingDirection

isClockwise

Whether elements rotate clockwise.

public bool isClockwise { get; }

Property Value

bool

isContinuousSpin

Whether to transition to synchronized continuous spin.

public bool isContinuousSpin { get; }

Property Value

bool

isLookForward

Whether elements should face forward along the path.

public bool isLookForward { get; }

Property Value

bool

isSimpleDelay

Whether a simple delay model is used.

public bool isSimpleDelay { get; }

Property Value

bool

movementCurve

Movement easing curve for element rotation.

public AnimationCurve movementCurve { get; }

Property Value

AnimationCurve

rotationArea

The area within which the animation is laid out.

public RectTransform rotationArea { get; }

Property Value

RectTransform

rotationDelay

Delay between starting consecutive element rotations.

public float rotationDelay { get; }

Property Value

float

rotationSpeed

Duration (in seconds) for a full rotation.

public float rotationSpeed { get; }

Property Value

float

startAngle

Starting rotation angle in degrees.

public int startAngle { get; }

Property Value

int

Methods

InitSpinners()

Stops current animation, re-initializes internals and updates the play flag.

public void InitSpinners()

Initialize(List<RectTransform>, RectTransform, int, float, float, float, bool, bool, bool, bool, bool, bool, SpinningType, FacingDirection, AnimationCurve)

Fully initializes the spinner with explicit elements, area, angles and behavior options.

public void Initialize(List<RectTransform> elements, RectTransform rotationArea, int startAngle, float rotationTime, float elementsOffset, float rotationDelay, bool isPlayOnEnable, bool isSpinning, bool isClockwise, bool isLookForward, bool isSimpleDelay, bool isContinuousSpin, SpinningType spinningType, FacingDirection facingDirection, AnimationCurve movementCurve)

Parameters

elements List<RectTransform>

Spinning elements.

rotationArea RectTransform

The bounds used to layout spinning.

startAngle int

Starting angle in degrees.

rotationTime float

Time for one full rotation, in seconds.

elementsOffset float

Distance factor between elements on the path.

rotationDelay float

Delay between element starts.

isPlayOnEnable bool

Whether to start spinning when enabled.

isSpinning bool

Initial spinning flag.

isClockwise bool

Rotate clockwise if true.

isLookForward bool

Face forward along path if true.

isSimpleDelay bool

Use simple delay model if true.

isContinuousSpin bool

Enable synchronized continuous spin after first loop.

spinningType SpinningType

Rotation geometry strategy.

facingDirection FacingDirection

Initial facing direction.

movementCurve AnimationCurve

Easing curve for movement.

Initialize(int, float, float, float, bool, bool, bool, bool, bool, bool, SpinningType, FacingDirection, AnimationCurve)

Initializes core parameters without changing elements collection and area.

public void Initialize(int startAngle, float rotationTime, float elementsOffset, float rotationDelay, bool isPlayOnEnable = true, bool isSpinning = true, bool isClockwise = true, bool isLookForward = false, bool isSimpleDelay = false, bool isContinuousSpin = false, SpinningType spinningType = SpinningType.Elliptical, FacingDirection facingDirection = FacingDirection.Top, AnimationCurve movementCurve = null)

Parameters

startAngle int

Starting angle in degrees.

rotationTime float

Time for one full rotation, in seconds.

elementsOffset float

Distance factor between elements on the path.

rotationDelay float

Delay between element starts.

isPlayOnEnable bool

Whether to play on enable.

isSpinning bool

Initial spinning flag.

isClockwise bool

Rotate clockwise if true.

isLookForward bool

Face forward along the path if true.

isSimpleDelay bool

Use simple delay model if true.

isContinuousSpin bool

Enable continuous spin synchronization after first loop.

spinningType SpinningType

Geometry strategy.

facingDirection FacingDirection

Initial facing direction.

movementCurve AnimationCurve

Easing curve; defaults to linear if null.

OnRectTransformDimensionsChange()

This callback is called when the dimensions of an associated RectTransform change. It is always called before Awake, OnEnable, or Start. The call is also made to all child RectTransforms, regardless of whether their dimensions change (which depends on how they are anchored).

protected override void OnRectTransformDimensionsChange()

Spin()

Starts or continues the spinning animation.

public void Spin()

Stop()

Stops the spinning animation.

public void Stop()