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 Object → Tween
Attributes NullableContextAttribute, NullableAttribute
Properties
Target
The target Object containing the member being tweened.
public object Target { get; }
Property Value
MemberName
The name of the member being tweened.
public abstract string MemberName { get; }
Property Value
Duration
Gets the duration of the Tween.
public float Duration { get; }
Property Value
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
Method
The TweenMethod to use when executing this tween.
public TweenMethod Method { get; }
Property Value
IsPaused
Gets or sets if the Tween is currently paused or not.
public bool IsPaused { get; set; }
Property Value
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
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
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
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