Skip to main content

Tween

Namespace: MonineEngine.Mathematics.Tweening

Base class for tween instances. Eases a value within an object from one value to another over a period of time, using certain easing.

public abstract class Tween

Inheritance ObjectTween
Attributes NullableContextAttribute, NullableAttribute

Properties

Target

The target Object containing the member being tweened.

public object Target { get; }

Property Value

Object

MemberName

The name of the member being tweened.

public abstract string MemberName { get; }

Property Value

String

Duration

Gets the duration of the Tween.

public float Duration { get; }

Property Value

Single

Delay

Gets the delay in seconds between each loop of the Tween.
This will only apply if TweenMethod is one of the following:

public float Delay { get; }

Property Value

Single

Method

The TweenMethod to use when executing this tween.

public TweenMethod Method { get; }

Property Value

TweenMethod

IsPaused

Gets or sets if the Tween is currently paused or not.

public bool IsPaused { get; set; }

Property Value

Boolean

IsComplete

Gets if the Tween has completed. If this Tween is set to loop, this will always be false.

public bool IsComplete { get; private set; }

Property Value

Boolean

TimeRemaining

Gets the time remaining in seconds before the Tween completes. If this Tween is set to loop, this value will be reset to 0 on each loop.

public float TimeRemaining { get; }

Property Value

Single

Progress

Gets the completion progress of the Tween, between 0 (start of the Tween) and 1 (end of the Tween).

public float Progress { get; }

Property Value

Single

Methods

Easing(TweenEaseType)

Sets the easing type of the Tween.

public Tween Easing(TweenEaseType easeType)

Parameters

easeType TweenEaseType
The easing type to use.

Returns

Tween
The current tween.

Easing(Func<Single, Single>)

Sets the easing functions of the Tween.

public Tween Easing(Func<float, float> easingFunc)

Parameters

easingFunc Func<Single, Single>
The easing functions to use.

Returns

Tween
The current tween.

Remarks:

In most cases, you will not need to call this yourself. This is instead handled automatically if using Tween.Easing(TweenEaseType).

OnBegin(Action<Tween>)

Sets a callback to occur when this Tween begins.

public Tween OnBegin(Action<Tween> callback)

Parameters

callback Action<Tween>
The callback to trigger.

Returns

Tween
The current tween.

OnUpdate(Action<Tween>)

Sets a callback to occur when this Tween updates. This is called directly after the tween updates the value.

public Tween OnUpdate(Action<Tween> callback)

Parameters

callback Action<Tween>
The callback to trigger.

Returns

Tween
The current tween.

OnComplete(Action<Tween>)

Sets a callback to occur when this Tween completes.

public Tween OnComplete(Action<Tween> callback)

Parameters

callback Action<Tween>
The callback to trigger.

Returns

Tween
The current tween.

Pause()

Pauses this Tween.

public Tween Pause()

Returns

Tween
The current tween.

Resume()

If paused, resumes this Tween.

public Tween Resume()

Returns

Tween
The current tween.

Start()

Starts the Tween.

public void Start()

Cancel()

Cancels the Tween.

public void Cancel()

Initialize()

protected abstract void Initialize()

UpdateValue(Single)

protected abstract void UpdateValue(float t)

Parameters

t Single