Table of Contents

Class UiAnimation

Namespace
MLEM.Ui
Assembly
MLEM.Ui.dll

A ui animation is a simple timed event that an Element in a UiSystem can use to play a visual or other type of animation. To use ui animations, you can use PlayAnimation(UiAnimation), or one of the built-in style properties like MouseEnterAnimation or MouseExitAnimation.

public class UiAnimation : GenericDataHolder, IGenericDataHolder
Inheritance
UiAnimation
Implements
Inherited Members
Extension Methods

Constructors

UiAnimation(double, AnimationFunction)

Creates a new ui animation with the given settings.

public UiAnimation(double seconds, UiAnimation.AnimationFunction function)

Parameters

seconds double

The amount of seconds that this ui animation should play for.

function UiAnimation.AnimationFunction

The UiAnimation.AnimationFunction that is invoked every Update(Element, GameTime).

UiAnimation(TimeSpan, AnimationFunction)

Creates a new ui animation with the given settings.

public UiAnimation(TimeSpan totalTime, UiAnimation.AnimationFunction function)

Parameters

totalTime TimeSpan

The TotalTime that this ui animation should play for.

function UiAnimation.AnimationFunction

The UiAnimation.AnimationFunction that is invoked every Update(Element, GameTime).

Fields

Finished

An event that is raised when this ui animation is stopped or finished through OnFinished(Element).

public Action<UiAnimation, Element> Finished

Field Value

Action<UiAnimation, Element>

Function

public readonly UiAnimation.AnimationFunction Function

Field Value

UiAnimation.AnimationFunction

Started

An event that is raised when this ui animation is (re)started in Update(Element, GameTime).

public Action<UiAnimation, Element> Started

Field Value

Action<UiAnimation, Element>

TotalTime

The total time that this ui animation plays for.

public readonly TimeSpan TotalTime

Field Value

TimeSpan

Properties

CurrentTime

The current time that this ui animation has been playing for, out of the TotalTime.

public TimeSpan CurrentTime { get; }

Property Value

TimeSpan

Methods

OnFinished(Element)

Causes this ui animation's Finished event to be raised, and sets the CurrentTime to Zero. This allows the animation to play from the start again. This method is invoked automatically when Update(Element, GameTime) returns true in Update(GameTime), as well as in StopAnimation(UiAnimation).

public virtual void OnFinished(Element element)

Parameters

element Element

Update(Element, GameTime)

Updates this ui animation, invoking its Started event if necessary, increasing its CurrentTime and invoking its Function. This method is called by an Element in Update(GameTime).

public virtual bool Update(Element element, GameTime time)

Parameters

element Element

The element that this ui animation is attached to.

time GameTime

The game's current time.

Returns

bool

Whether this animation is ready to finish, that is, if its CurrentTime is greater than or equal to its TotalTime.