Tween

A tween handles the transition from one value to another value based on a transition duration.

Constructors

this
this(float a, float b, float duration, TweenMode mode, EasingFunc f)

Creates a new tween.

Members

Functions

elapsedTime
float elapsedTime()

Returns the current animation time.

elapsedTime
float elapsedTime(float time)

Sets the current animation time to a specific value and returns the current animation value.

hasFinished
bool hasFinished()

Returns true if the animation has finished. This function makes sense when the tween mode is set to bomb.

hasStarted
bool hasStarted()

Returns true if the animation has started. This function makes sense when the tween mode is set to bomb.

now
float now()

Returns the current animation value. The value is between the first and the last animation value.

progress
float progress()

Returns the current animation progress. The progress is between 0.0 and 1.0.

progress
void progress(float value)

Sets the current animation progress to a specific value. The progress is between 0.0 and 1.0.

reset
void reset()

Resets the current animation time.

update
float update(float dt)

Updates the current animation time by the given delta time and returns the current animation value.

Variables

a
float a;

The first animation value.

b
float b;

The last animation value.

duration
float duration;

The duration of the animation.

f
EasingFunc f;

The function used to ease from the first to the last value.

isYoyoing
bool isYoyoing;

Controls if the delta time given to the update function is reversed.

mode
TweenMode mode;

The mode of the animation.

time
float time;

The current time of the animation.

Meta