DOTween  0.8.530
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
TweenExtensions Class Reference

Methods that extend Tween objects and allow to control or get data from them More...

Static Public Member Functions

static void Complete (this Tween t)
 Completes the tween More...
 
static void Flip (this Tween t)
 Flips the direction of this tween (backwards if it was going forward or viceversa) More...
 
static void Goto (this Tween t, float to, bool andPlay=false)
 Send the tween to the given position in time More...
 
static void Kill (this Tween t)
 Kills the tween More...
 
static T Pause< T > (this T t)
 Pauses the tween More...
 
static T Play< T > (this T t)
 Plays the tween More...
 
static void PlayBackwards (this Tween t)
 Sets the tween in a backwards direction and plays it More...
 
static void PlayForward (this Tween t)
 Sets the tween in a forward direction and plays it More...
 
static void Restart (this Tween t, bool includeDelay=true)
 Restarts the tween from the beginning More...
 
static void Rewind (this Tween t, bool includeDelay=true)
 Rewinds the tween More...
 
static void TogglePause (this Tween t)
 Plays the tween if it was paused, pauses it if it was playing More...
 
static YieldInstruction WaitForCompletion (this Tween t)
 Creates a yield instruction that waits until the tween is killed or complete. It can be used inside a coroutine as a yield. More...
 
static YieldInstruction WaitForKill (this Tween t)
 Creates a yield instruction that waits until the tween is killed. It can be used inside a coroutine as a yield. More...
 
static YieldInstruction WaitForElapsedLoops (this Tween t, int elapsedLoops)
 Creates a yield instruction that waits until the tween is killed or has gone through the given amount of loops. It can be used inside a coroutine as a yield. More...
 
static YieldInstruction WaitForPosition (this Tween t, float position)
 Creates a yield instruction that waits until the tween is killed or has reached the given position (loops included, delays excluded). It can be used inside a coroutine as a yield. More...
 
static Coroutine WaitForStart (this Tween t)
 Creates a yield instruction that waits until the tween is killed or started (meaning when the tween is set in a playing state the first time, after any eventual delay). It can be used inside a coroutine as a yield. More...
 
static int CompletedLoops (this Tween t)
 Returns the total number of loops completed by this tween More...
 
static float Delay (this Tween t)
 Returns the eventual delay set for this tween More...
 
static float Duration (this Tween t, bool includeLoops=true)
 Returns the duration of this tween (delays excluded). More...
 
static float Elapsed (this Tween t, bool includeLoops=true)
 Returns the elapsed time for this tween (delays exluded) More...
 
static float ElapsedPercentage (this Tween t, bool includeLoops=true)
 Returns the elapsed percentage (0 to 1) of this tween (delays exluded) More...
 
static bool IsActive (this Tween t)
 Returns FALSE if this tween has been killed. More...
 
static bool IsBackwards (this Tween t)
 Returns TRUE if this tween was reversed and is set to go backwards More...
 
static bool IsPlaying (this Tween t)
 Returns TRUE if this tween is playing More...
 

Detailed Description

Methods that extend Tween objects and allow to control or get data from them

Member Function Documentation

static void Complete ( this Tween  t)
static

Completes the tween

static int CompletedLoops ( this Tween  t)
static

Returns the total number of loops completed by this tween

static float Delay ( this Tween  t)
static

Returns the eventual delay set for this tween

static float Duration ( this Tween  t,
bool  includeLoops = true 
)
static

Returns the duration of this tween (delays excluded).

NOTE: when using settings like SpeedBased, the duration will be recalculated when the tween starts

Parameters
includeLoopsIf TRUE returns the full duration loops included, otherwise the duration of a single loop cycle
static float Elapsed ( this Tween  t,
bool  includeLoops = true 
)
static

Returns the elapsed time for this tween (delays exluded)

Parameters
includeLoopsIf TRUE returns the elapsed time since startup loops included, otherwise the elapsed time within the current loop cycle
static float ElapsedPercentage ( this Tween  t,
bool  includeLoops = true 
)
static

Returns the elapsed percentage (0 to 1) of this tween (delays exluded)

Parameters
includeLoopsIf TRUE returns the elapsed percentage since startup loops included, otherwise the elapsed percentage within the current loop cycle
static void Flip ( this Tween  t)
static

Flips the direction of this tween (backwards if it was going forward or viceversa)

static void Goto ( this Tween  t,
float  to,
bool  andPlay = false 
)
static

Send the tween to the given position in time

Parameters
toTime position to reach (if higher than the whole tween duration the tween will simply reach its end)
andPlayIf TRUE will play the tween after reaching the given position, otherwise it will pause it
static bool IsActive ( this Tween  t)
static

Returns FALSE if this tween has been killed.

BEWARE: if this tween is recyclable it might have been spawned again for another use and thus return TRUE anyway.

When working with recyclable tweens you should take care to know when a tween has been killed and manually set your references to NULL. If you want to be sure your references are set to NULL when a tween is killed you can use the OnKill callback like this:

.OnKill(()=> myTweenReference = null)

static bool IsBackwards ( this Tween  t)
static

Returns TRUE if this tween was reversed and is set to go backwards

static bool IsPlaying ( this Tween  t)
static

Returns TRUE if this tween is playing

static void Kill ( this Tween  t)
static

Kills the tween

static T Pause< T > ( this T  t)
static

Pauses the tween

Type Constraints
T :Tween 
static T Play< T > ( this T  t)
static

Plays the tween

Type Constraints
T :Tween 
static void PlayBackwards ( this Tween  t)
static

Sets the tween in a backwards direction and plays it

static void PlayForward ( this Tween  t)
static

Sets the tween in a forward direction and plays it

static void Restart ( this Tween  t,
bool  includeDelay = true 
)
static

Restarts the tween from the beginning

Parameters
includeDelayIf TRUE includes the eventual tween delay, otherwise skips it
static void Rewind ( this Tween  t,
bool  includeDelay = true 
)
static

Rewinds the tween

Parameters
includeDelayIf TRUE includes the eventual tween delay, otherwise skips it
static void TogglePause ( this Tween  t)
static

Plays the tween if it was paused, pauses it if it was playing

static YieldInstruction WaitForCompletion ( this Tween  t)
static

Creates a yield instruction that waits until the tween is killed or complete. It can be used inside a coroutine as a yield.

Example usage:

yield return myTween.WaitForCompletion();

static YieldInstruction WaitForElapsedLoops ( this Tween  t,
int  elapsedLoops 
)
static

Creates a yield instruction that waits until the tween is killed or has gone through the given amount of loops. It can be used inside a coroutine as a yield.

Example usage:

yield return myTween.WaitForElapsedLoops(2);

Parameters
elapsedLoopsElapsed loops to wait for
static YieldInstruction WaitForKill ( this Tween  t)
static

Creates a yield instruction that waits until the tween is killed. It can be used inside a coroutine as a yield.

Example usage:

yield return myTween.WaitForKill();

static YieldInstruction WaitForPosition ( this Tween  t,
float  position 
)
static

Creates a yield instruction that waits until the tween is killed or has reached the given position (loops included, delays excluded). It can be used inside a coroutine as a yield.

Example usage:

yield return myTween.WaitForPosition(2.5f);

Parameters
positionPosition (loops included, delays excluded) to wait for
static Coroutine WaitForStart ( this Tween  t)
static

Creates a yield instruction that waits until the tween is killed or started (meaning when the tween is set in a playing state the first time, after any eventual delay). It can be used inside a coroutine as a yield.

Example usage:

yield return myTween.WaitForStart();