Table of Contents

Class Tween

A tween is a simple interpolation from 0 to 1 which has several options and events attached. For more information please go to https://flowent.friedsynapse.com/tween

public sealed class Tween : AbstractAnimation, IControllable
Inheritance
Tween
Implements
Inherited Members
Extension Methods

Constructors

Tween(TweenOptions)

Creates a new tween using the options provided.

public Tween(TweenOptions options)

Parameters

options TweenOptions

Tween(float, bool)

Creates a new tween.

public Tween(float time = 1, bool autoStart = false)

Parameters

time float

The amount of time for this tween in seconds.

autoStart bool

Whether the tween should start automatically or not.

Properties

Easing

public IEasing Easing { get; }

Property Value

IEasing

LoopType

public LoopType LoopType { get; }

Property Value

LoopType

Time

public float Time { get; }

Property Value

float

Methods

Apply(params AbstractTweenMotion[])

Applies all the motions to the current tween.

public Tween Apply(params AbstractTweenMotion[] motions)

Parameters

motions AbstractTweenMotion[]

Returns

Tween

Apply(IEnumerable<AbstractTweenMotion>)

Applies all the motions to the current tween.

public Tween Apply(IEnumerable<AbstractTweenMotion> motions)

Parameters

motions IEnumerable<AbstractTweenMotion>

Returns

Tween

Conditional(Func<bool>, Action<Tween>)

Executes the onConditionTrue if condition returns true.

public Tween Conditional(Func<bool> condition, Action<Tween> onConditionTrue)

Parameters

condition Func<bool>

The condition.

onConditionTrue Action<Tween>

The callback.

Returns

Tween

ForAll<TItem>(IEnumerable<TItem>)

Creates a scope for the object so you can add motions designed specifically for that enumeration of objects.

public TweenMotionProxyArray<TItem> ForAll<TItem>(IEnumerable<TItem> elements)

Parameters

elements IEnumerable<TItem>

Returns

TweenMotionProxyArray<TItem>

Type Parameters

TItem

For<TItem>(TItem)

Creates a scope for the object so you can add motions designed specifically for that object.

public TweenMotionProxy<TItem> For<TItem>(TItem element)

Parameters

element TItem

Returns

TweenMotionProxy<TItem>

Type Parameters

TItem

For<TItem>(params TItem[])

Creates a scope for the object so you can add motions designed specifically for that array of objects.

public TweenMotionProxyArray<TItem> For<TItem>(params TItem[] elements)

Parameters

elements TItem[]

Returns

TweenMotionProxyArray<TItem>

Type Parameters

TItem

OnCompleted(Action)

Adds an event called when the animation has completed.

public Tween OnCompleted(Action callback)

Parameters

callback Action

The event.

Returns

Tween

OnCompleting(Action)

Adds an event called when the animation is completing.

public Tween OnCompleting(Action callback)

Parameters

callback Action

The event.

Returns

Tween

OnLoopCompleted(Action<int?>)

Adds an event called when the animation loop has completed.

public Tween OnLoopCompleted(Action<int?> callback)

Parameters

callback Action<int?>

The event. The parameter represents the number of loops left. If there are infinite loops it'll send a null param.

Returns

Tween

OnLoopStarted(Action<int?>)

Adds an event called when the animation loop has started.

public Tween OnLoopStarted(Action<int?> callback)

Parameters

callback Action<int?>

The event. The parameter represents the number of loops left. If there are infinite loops it'll send a null param.

Returns

Tween

OnStarted(Action)

Adds an event called when the animation has started.

public Tween OnStarted(Action callback)

Parameters

callback Action

The event.

Returns

Tween

OnStarting(Action)

Adds an event called when the animation is starting.

public Tween OnStarting(Action callback)

Parameters

callback Action

The event.

Returns

Tween

OnUpdated(Action<float>)

Adds an event called when the animation has updated.

public Tween OnUpdated(Action<float> callback)

Parameters

callback Action<float>

The event.

Returns

Tween

OnUpdating(Action<float>)

Adds an event called when the animation is updating.

public Tween OnUpdating(Action<float> callback)

Parameters

callback Action<float>

The event.

Returns

Tween

Pause()

Pauses the animation.

public Tween Pause()

Returns

Tween

Reset()

Resets the animation so in can be replayed.

public Tween Reset()

Returns

Tween

Exceptions

AnimationException

If the animation is not finished.

AnimationException

If the tween is not finished.

ResetInternal()

protected override void ResetInternal()

Resume()

Resumes the animation.

public Tween Resume()

Returns

Tween

SetAutoStart(bool)

Sets whether this animation should auto-start or not.

public Tween SetAutoStart(bool autoStart)

Parameters

autoStart bool

Returns

Tween

Remarks

Auto-start will be slower than a true-start. See more at https://flowent.friedsynapse.com/tips#h.s5cucrg5qyjc

SetDelay(float)

Sets the amount of time in seconds that you want to delay when this animation is started.

public Tween SetDelay(float time)

Parameters

time float

Returns

Tween

SetDelayUntil(Func<bool>)

Sets the callback that holds the starting of the animation.

public Tween SetDelayUntil(Func<bool> callback)

Parameters

callback Func<bool>

Returns

Tween

SetEasing(AnimationCurve, bool)

Sets the easing of the tween using an animation curve.

public Tween SetEasing(AnimationCurve animationCurve, bool reverse = false)

Parameters

animationCurve AnimationCurve
reverse bool

Will apply a reverse on the easing.

Returns

Tween

SetEasing(Easing, bool)

Sets the easing of the tween using predefined values.

public Tween SetEasing(Easing easing, bool reverse = false)

Parameters

easing Easing
reverse bool

Will apply a reverse on the easing.

Returns

Tween

SetEasing(IEasing, bool)

Sets the easing of the tween.

public Tween SetEasing(IEasing easing, bool reverse = false)

Parameters

easing IEasing
reverse bool

Will apply a reverse on the easing.

Returns

Tween

SetEasing(Func<float, float>, bool)

Sets the easing of the tween using a FunctionEasing.

public Tween SetEasing(Func<float, float> easing, bool reverse = false)

Parameters

easing Func<float, float>
reverse bool

Will apply a reverse on the easing.

Returns

Tween

SetEvents(TweenEvents)

Sets all the events for this tween.

public Tween SetEvents(TweenEvents events)

Parameters

events TweenEvents

Returns

Tween

SetEvents(Func<TweenEvents, TweenEvents>)

Creates a builder for events and then sets all the events for this tween.

public Tween SetEvents(Func<TweenEvents, TweenEvents> eventsBuilder)

Parameters

eventsBuilder Func<TweenEvents, TweenEvents>

Returns

Tween

SetLoopCount(int?)

Sets the amount of loops you want this animation to have. If you want infinite loops pass a null value.

public Tween SetLoopCount(int? loopCount)

Parameters

loopCount int?

Returns

Tween

Remarks

Flows only have reset loop types.

SetLoopType(LoopType)

Sets the loop type of the tween.

public Tween SetLoopType(LoopType loopType)

Parameters

loopType LoopType

Returns

Tween

SetName(string)

Sets the name of the animation.

public Tween SetName(string name)

Parameters

name string

Returns

Tween

SetOptions(TweenOptions)

Sets all the options for this tween.

public Tween SetOptions(TweenOptions options)

Parameters

options TweenOptions

Returns

Tween

SetOptions(Func<TweenOptions, TweenOptions>)

Creates a builder for options and then sets all the options for this tween.

public Tween SetOptions(Func<TweenOptions, TweenOptions> optionsBuilder)

Parameters

optionsBuilder Func<TweenOptions, TweenOptions>

Returns

Tween

SetSkipFrames(int)

Sets the amount of frames you want to skip at when this animation is started.

public Tween SetSkipFrames(int frames)

Parameters

frames int

Returns

Tween

SetTime(float)

Sets the amount of time in seconds that this tween will last.

public Tween SetTime(float time)

Parameters

time float

Returns

Tween

SetTimeScale(float)

Sets the time scale for the current animation.

public Tween SetTimeScale(float timeScale)

Parameters

timeScale float

Returns

Tween

SetUpdateType(UpdateType)

Sets the update type for the animation.

public Tween SetUpdateType(UpdateType updateType)

Parameters

updateType UpdateType

Returns

Tween

Start()

Starts the animation.

public Tween Start()

Returns

Tween

Exceptions

AnimationException

If the tween has already started.

StartAsync(CancellationToken?)

Starts the animation async(you can await this till the animation finishes).

public Task<Tween> StartAsync(CancellationToken? token = null)

Parameters

token CancellationToken?

The cancellation doesn't cancel the task, but rather terminates the animation. The task will be completed

Returns

Task<Tween>

Exceptions

AnimationException

If the tween has already started.

Stop(bool)

Stops the animation.

public Tween Stop(bool triggerOnCompleted = false)

Parameters

triggerOnCompleted bool

If set to true will trigger the "OnCompleted" event on the animation

Returns

Tween