Skip to main content

ScalingFadeAnimator

A class in Root.Township, Alta.Meta.UI.

Client UI: scales its targets up along a curve when enabled, and can scale them down then switch to another object. Locks UI actions while animating.

Constructors​

MemberWhat it is
ScalingFadeAnimator()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

6 private and internal fields
MemberWhat it is
private float currentTimeNormalised animation time.
private GameObject enableOnFinishObject to show when the scale-down ends.
private AnimationCurve scaleOverTimeCurve of scale over time; its last key sets the duration.
private Coroutine scalingThe running scale coroutine.
private Transform[] targetsTransforms scaled by the animation.
private float targetTimeTime being animated to: 1 to show, 0 to hide.

Methods​

MemberWhat it is
void Fade(GameObject fadeTo)Scales down, then hides this object and shows the given one. Ignored while UI actions are locked.
void Fade(GameObject fadeTo, Action onComplete)Scales down, then hides this object and shows the given one. Ignored while UI actions are locked.
3 private and internal methods
MemberWhat it is
private void OnDestroy()Releases its UI action lock.
private void OnEnable()Starts scaling up from zero.
private IEnumerator ScalingCoroutine(Action onComplete = null) (iterator)Moves the animation time to its target, applying the curve to every target's scale, then finishes the switch.

Used in​

Members of other types that take, return or hold a ScalingFadeAnimator: