RaTweening 1.0.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
RaTweening.RaTweenSequence Class Reference

This class takes control over all appended tweens submitted as sequence entries and evaluates them in sequence. OnComplete is called when all tweens have finished inside of it.

‍Note: A RaTweenSequence is constructed using the RaTweenSequence.Create(EntryData[]) method
Note: Tweens can be converted easily to EntryData using the RaTweenUtilExtensions.ToSequenceEntry(RaTweenBase, float, StaggerType) method

More...

Inheritance diagram for RaTweening.RaTweenSequence:
RaTweening.RaTweenBase

Classes

struct  EntryData
 This struct represents an entry within a sequence. Holding the data what tween to play and their sequence settings More...
 

Public Types

enum  StaggerType
 Each of the enum values represents a stagger setting
 
- Public Types inherited from RaTweening.RaTweenBase
enum  State
 The state in which a tween can be found
 

Public Member Functions

RaTweenSequence AppendCallback (Action callback)
 Appends a callback to the sequence. (converts it to a EntryData)

‍Note: A callback has a duration of 0
Note: Consecutive callbacks are all executed within the same frame


 
RaTweenSequence AppendCallbacks (IList< Action > callbacks)
 Appends a set of callbacks to the sequence. (converts it to a EntryData)

‍Note: A callback has a duration of 0
Note: Consecutive callbacks are all executed within the same frame
Note: This method is more optimized than calling AppendCallback(Action) for each individual entry for it saves some calculation steps for when everything has been appended


 
RaTweenSequence AppendTween (RaTweenBase tween, float stagger=1f, StaggerType staggerType=StaggerType.FinalLoopExclDelay)
 Appends a tween to the sequence. (converts it to a EntryData)

‍Note: The stagger has no effect when the tween is the last in the sequence
Note: The OnComplete is called when all tweens are finished, even if the last tween has a stagger lower than 1.

More...
 
RaTweenSequence Append (EntryData entry)
 Appends an Entry to the sequence.
 
RaTweenSequence Append (IList< EntryData > entries)
 Appends a set of Entries to the sequence in order.

‍Note: This method is more optimized than calling Append(EntryData) for each individual entry for it saves some calculation steps for when everything has been appended
Note: This method is also used by the Create(EntryData[]) method to optimize the creation of the tween


 
RaTweenSequence PrependCallback (Action callback)
 Prepends a callback to the sequence. (converts it to a EntryData)

‍Note: A callback has a duration of 0
Note: Consecutive callbacks are all executed within the same frame


 
RaTweenSequence PrependCallbacks (IList< Action > callbacks)
 Prepends a set of callbacks to the sequence. (converts it to a EntryData)

‍Note: A callback has a duration of 0
Note: Consecutive callbacks are all executed within the same frame
Note: So if the sequence is [a, b, c] and you prepend [q, w, e], then the order would be [q, w, e, a, b, c]
Note: This method is more optimized than calling PrependCallback(Action) for each individual entry for it saves some calculation steps for when everything has been appended


 
RaTweenSequence PrependTween (RaTweenBase tween, float stagger=1f, StaggerType staggerType=StaggerType.FinalLoopExclDelay)
 Preprends a tween to the sequence. (converts it to a EntryData)

‍Note: The stagger has no effect when the tween is the last in the sequence
Note: The OnComplete is called when all tweens are finished, even if the last tween has a stagger lower than 1.

More...
 
RaTweenSequence Prepend (EntryData entry)
 Preprends an Entry to the sequence.
 
RaTweenSequence Prepend (IList< EntryData > entries)
 Preprends a set of Entries to the sequence in order.

‍Note: So if the sequence is [a, b, c] and you prepend [q, w, e], then the order would be [q, w, e, a, b, c]
Note: This method is more optimized than calling Prepend(EntryData) for each individual entry for it saves some calculation steps for when everything has been appended


 
RaTweenSequence Insert (int index, IList< EntryData > entries)
 Inserts a set of Entries at an index in the order it was given.

‍Note: So if the sequence is [a, b, c] and you insert [q, w, e] at index 0, then the order would be [q, w, e, a, b, c]
Note: When the index is out of range, it is clamped by the method.
Note: This method is more optimized than calling Append(EntryData) for each individual entry for it saves some calculation steps for when everything has been appended

More...
 
- Public Member Functions inherited from RaTweening.RaTweenBase
delegate void CallbackHandler ()
 
delegate void LoopCallbackHandler (int loopCount)
 
 RaTweenBase (float duration)
 
bool IsAlive (bool inclEnded)
 Returns true if the tween is a living tween

‍Note: A living tween is one which is not State.None, State.Dead or State.Data
Note: A living tween is one which is being processed, to be processed or ended processing by a RaTweenSequence or the RaTweeningEngine

More...
 
bool Pause ()
 An API Call which pauses the tween on the next processor step More...
 
bool Resume ()
 An API Call which resumes the tween on the next processor step More...
 
bool Stop ()
 An API Call which Ends a tween by stopping it abruptly More...
 
bool Rewind (bool inclDelay=true)
 An API Call which Rewinds the tween and evaluates its first frame

‍Note: This will Reset all timers and Refresh internal data
Note: This does not change the TweenState

More...
 
bool Reset (bool resumeAfterReset=false)
 An API Call which Resets the Tween

‍Note: This will Reset all timers and Refresh internal data
Note: This will automatically put the tween in the IsPaused state.

More...
 
bool Complete ()
 An API Call which force completes the tween on the next processor step

‍Note: It will skip over any callbacks which would happen between the current state of the tween and complete. And only call the Completion callback and all after.
Note: Does not work on a tween that HasEnded

More...
 
RaTweenBase Clone (bool inclEvents)
 Creates a clone of the tween. Which is a completely separate instance with cleared event hooks. All other settings such as delay, duration, target and more will be copied over to the new instance More...
 
bool CanBeModified ()
 Represents when modification calls will be applied to the tween or not. Modification Calls are methods such as, but not limited to; setting the Delay, Duration, Target, Loop Count, Listen to Events of a tween.

‍Note: All modification calls can only be made when the state is State.None or State.ToStart

More...
 
bool CanUseAPI (bool inclEnded)
 Represents when API calls will be made on the tween or not. API Calls are methods which make request to the tween, such as Pause, Resume, Stop, Complete

‍Note: All API calls can only be made when the tween IsAlive(bool)

More...
 

Static Public Member Functions

static RaTweenSequence Create (params EntryData[] tweens)
 Creates an instance of a RaTweenSequence.

‍Note: This replaces the constructor
Note: This method uses the Append(IList<EntryData>) method to append the tweens internally


 
- Static Public Member Functions inherited from RaTweening.RaTweenBase
static RaTweenBase[] GetGroup (object groupID, bool inclEnded)
 Returns all IsAlive(bool) Tweens under a given GroupID set by RaTweenUtilExtensions.SetGroup<TweenT>(TweenT, object)

‍Note: When the tween is Submitted to a Processor, only then does the tween become part of the GroupID it is assigned to.
Note: A Tween is Submitted to a Processor when it is Registered to the RaTweeningEngine (When Play<TweenT>(TweenT) is called on it)

More...
 
static void StopGroup (object groupID)
 Calls Stop on all Tweens under a given GroupID set by RaTweenUtilExtensions.SetGroup<TweenT>(TweenT, object)

‍Note: When the tween is Submitted to a Processor, only then does the tween become part of the GroupID it is assigned to.
Note: A Tween is Submitted to a Processor when it is Registered to the RaTweeningEngine (When Play<TweenT>(TweenT) is called on it)


 
static void CompleteGroup (object groupID)
 Calls Complete on all Tweens under a given GroupID set by RaTweenUtilExtensions.SetGroup<TweenT>(TweenT, object)

‍Note: When the tween is Submitted to a Processor, only then does the tween become part of the GroupID it is assigned to.
Note: A Tween is Submitted to a Processor when it is Registered to the RaTweeningEngine (When Play<TweenT>(TweenT) is called on it)


 
static void PauseGroup (object groupID)
 Calls Pause on all Tweens under a given GroupID set by RaTweenUtilExtensions.SetGroup<TweenT>(TweenT, object)

‍Note: When the tween is Submitted to a Processor, only then does the tween become part of the GroupID it is assigned to.
Note: A Tween is Submitted to a Processor when it is Registered to the RaTweeningEngine (When Play<TweenT>(TweenT) is called on it)


 
static void ResumeGroup (object groupID)
 Calls Resume on all Tweens under a given GroupID set by RaTweenUtilExtensions.SetGroup<TweenT>(TweenT, object)

‍Note: When the tween is Submitted to a Processor, only then does the tween become part of the GroupID it is assigned to.
Note: A Tween is Submitted to a Processor when it is Registered to the RaTweeningEngine (When Play<TweenT>(TweenT) is called on it)


 

Protected Member Functions

override void OnSetup ()
 
override void ResetData ()
 
override void OnKill ()
 For Clean-up, use Dispose instead. This is a notification before disposal More...
 
override void OnLoop ()
 
override void OnComplete ()
 
override void ApplyReset (bool resumeAfterReset)
 
override void ApplyRewind (bool inclDelay)
 
override RaTweenBase CloneSelf ()
 
override void Dispose ()
 
override void Evaluate (float normalizedValue)
 
override float CalculateEvaluation ()
 
override void SetDefaultValues ()
 
- Protected Member Functions inherited from RaTweening.RaTweenBase
abstract void SetDefaultValues ()
 
void SetInfiniteDuration ()
 
void SetDuration (float duration)
 
virtual void OnSetup ()
 
virtual void OnStart ()
 
virtual void OnLoop ()
 
virtual void ResetData ()
 
virtual void OnSetDuration (float duration)
 
virtual void OnComplete ()
 
virtual void OnEnd ()
 
virtual void OnKill ()
 For Clean-up, use Dispose instead. This is a notification before disposal More...
 
abstract RaTweenBase CloneSelf ()
 
abstract void Evaluate (float normalizedValue)
 
abstract void ApplyRewind (bool inclDelay)
 
abstract void ApplyReset (bool resumeAfterReset)
 
abstract void Dispose ()
 
abstract float CalculateEvaluation ()
 

Properties

override bool IsValid [get]
 
- Properties inherited from RaTweening.RaTweenBase
float TimeScale [get]
 A Scaler which represents at what relative speed the tween evaluates. (1 being normal speed, 2 being double speed etc)

‍Note: This affects both the Delay as Evaluation speed
Note: This returns the ITimeScaleChannel.ITimeScaleChannel.TimeScale * Tween.TimeScaleValue (passed with RaTweenUtilExtensions.SetTimeScale<TweenT>(TweenT, float))
Note: If there is no ITimeScaleChannel passed to the tween, this will return Tween.TimeScaleValue instead.
Note: This value will never go below 0.


 
object GroupID [get]
 The GroupID Represents the Group in which the Tween was placed within the RaTweeningProcessor
 
abstract bool IsValid [get]
 IsValid will return true when the tween is able to apply its changes to the target. If IsValid returns false, it will be killed automatically when registered to a RaTweenProcessor
 
float Delay [get]
 This value represent the duration of the delay of the tween in seconds.

‍Note: No evaluation is applied to the target while the delay is running


 
float DelayProgress [get]
 The Normalized Progress of the delay. 0 being at the start 1 being at the end
 
bool HasNoDelayRemaining [get]
 Returns true when the delay process has been completed (or was empty)
 
bool IsInfinite [get]
 Returns whether the tween itself is infinite. Not to be confused with IsInfiniteLoop, which returns if a finite loop is looping infinitely
 
float Duration [get]
 Represents the duration of the actual tween after the delay in seconds
 
float Progress [get]
 The Normalized Progress of the delay. 0 being at the start 1 being at the end
 
float Time [get]
 Represents the time in seconds that the tween has progressed.
 
float TotalTime [get]
 The Time that has passed in seconds in delay + the actual tween Delay Time + Time
 
float TotalDuration [get]
 Represents the duration of the delay plus the actual tween in seconds Delay + Duration
 
float TotalProgress [get]
 The Normalized Progress of the delay + the actual tween. 0 being at the start 1 being at the end
 
bool IsTotalCompleted [get]
 Returns true if the delay + actual tween has reached their end
 
bool IsLoop [get]
 Returns true if the tween is set to loop
 
bool IsInfiniteLoop [get]
 Returns true if the tween loops an infinite amount of times (unless manually stopped)
 
int Loops [get]
 Returns the amount of loops the tween desires to make before marking itself as completed.

‍Note: this will return InfiniteLoopingValue if IsInfiniteLoop is set to true


 
bool IncludeDelayInLoops [get]
 
float TotalLoopingTime [get]
 The Time of TotalTime in total of all its Passed Loops. Delay Time + Time & Loops
 
float TotalLoopingDuration [get]
 Represents the duration of TotalDuration in total of Total Loops. Delay + Duration & Loops

‍Note: this will return InfiniteLoopingValue if IsInfiniteLoop is set to true


 
float TotalLoopingProgress [get]
 The Normalized value of TotalProgress in total of Total Loops. 0 being at the start 1 being at the end DelayProgress + Progress & Loops

‍Note: this will return InfiniteLoopingValue if IsInfiniteLoop is set to true


 
bool HasReachedLoopEnd [get]
 Returns true if the the current running tween is the last of the loop cycle Returns true on the first tween when it has no loops

‍Note: this will always return false if IsInfiniteLoop is set to true


 
bool PauseOnEnd [get]
 When True, this pauses the Tween when it Ends This prevents it from being Killed by the RaTweeningProcessor
 
bool HasEnded [get]
 Returns True if the tween has ended. By going through the natural flow or by calling Stop
 
bool IsSetup [get]
 Returns True if the tween has been Setup. Meaning it triggered the OnSetup callback of the tween.

‍Note: This happens when a tween is registered to a RaTweeningProcessor and the State.ToStart state is processed.


 
bool HasStarted [get]
 Returns True if the tween has transitioned from the State.InDelay state to the State.InProgress state.

‍Note: This resets to False every time the tween is set back in the State.InDelay state.


 
bool IsEmpty [get]
 Returns true if Delay and Duration are both 0
 
State TweenState [get]
 The current state of the tween.

‍Note: A tween can only be manipulated when CanBeModified returns true.
Note: API calls on a tween can only be made when CanUseAPI returns true.
Note: To check if a tween is playing, please use IsPlaying
Note: To check if a tween is paused, please use IsPaused
Note: To check if a tween is completed, please use IsCompleted


 
bool IsPlaying [get]
 Returns true if the tween is in its delay or in its active tween evaluation
 
bool IsPaused [get]
 Returns true when a tween is in its paused state
 
bool IsCompleted [get]
 Returns true when a tween has been completed Meaning fully played or force completed using Complete
 

Additional Inherited Members

- Static Public Attributes inherited from RaTweening.RaTweenBase
const int InfiniteLoopingValue = -1
 The value used to assign and represent Infinity
 

Detailed Description

This class takes control over all appended tweens submitted as sequence entries and evaluates them in sequence. OnComplete is called when all tweens have finished inside of it.

‍Note: A RaTweenSequence is constructed using the RaTweenSequence.Create(EntryData[]) method
Note: Tweens can be converted easily to EntryData using the RaTweenUtilExtensions.ToSequenceEntry(RaTweenBase, float, StaggerType) method

Member Function Documentation

◆ AppendTween()

RaTweenSequence RaTweening.RaTweenSequence.AppendTween ( RaTweenBase  tween,
float  stagger = 1f,
StaggerType  staggerType = StaggerType.FinalLoopExclDelay 
)

Appends a tween to the sequence. (converts it to a EntryData)

‍Note: The stagger has no effect when the tween is the last in the sequence
Note: The OnComplete is called when all tweens are finished, even if the last tween has a stagger lower than 1.

Parameters
staggerThe amount of % (value between 0 - 1) must be finished of this tween before the next tween of the sequence should be started
staggerTypeThe selected StaggerType which defines what the stagger parameter represents

◆ ApplyReset()

override void RaTweening.RaTweenSequence.ApplyReset ( bool  resumeAfterReset)
protectedvirtual

◆ ApplyRewind()

override void RaTweening.RaTweenSequence.ApplyRewind ( bool  inclDelay)
protectedvirtual

◆ CalculateEvaluation()

override float RaTweening.RaTweenSequence.CalculateEvaluation ( )
protectedvirtual

◆ CloneSelf()

override RaTweenBase RaTweening.RaTweenSequence.CloneSelf ( )
protectedvirtual

◆ Dispose()

override void RaTweening.RaTweenSequence.Dispose ( )
protectedvirtual

◆ Evaluate()

override void RaTweening.RaTweenSequence.Evaluate ( float  normalizedValue)
protectedvirtual

◆ Insert()

RaTweenSequence RaTweening.RaTweenSequence.Insert ( int  index,
IList< EntryData entries 
)

Inserts a set of Entries at an index in the order it was given.

‍Note: So if the sequence is [a, b, c] and you insert [q, w, e] at index 0, then the order would be [q, w, e, a, b, c]
Note: When the index is out of range, it is clamped by the method.
Note: This method is more optimized than calling Append(EntryData) for each individual entry for it saves some calculation steps for when everything has been appended

Parameters
indexThe index at which to Insert
entriesThe entries to add to the sequence
Returns

◆ OnComplete()

override void RaTweening.RaTweenSequence.OnComplete ( )
protectedvirtual

Reimplemented from RaTweening.RaTweenBase.

◆ OnKill()

override void RaTweening.RaTweenSequence.OnKill ( )
protectedvirtual

For Clean-up, use Dispose instead. This is a notification before disposal

Reimplemented from RaTweening.RaTweenBase.

◆ OnLoop()

override void RaTweening.RaTweenSequence.OnLoop ( )
protectedvirtual

Reimplemented from RaTweening.RaTweenBase.

◆ OnSetup()

override void RaTweening.RaTweenSequence.OnSetup ( )
protectedvirtual

Reimplemented from RaTweening.RaTweenBase.

◆ PrependTween()

RaTweenSequence RaTweening.RaTweenSequence.PrependTween ( RaTweenBase  tween,
float  stagger = 1f,
StaggerType  staggerType = StaggerType.FinalLoopExclDelay 
)

Preprends a tween to the sequence. (converts it to a EntryData)

‍Note: The stagger has no effect when the tween is the last in the sequence
Note: The OnComplete is called when all tweens are finished, even if the last tween has a stagger lower than 1.

Parameters
staggerThe amount of % (value between 0 - 1) must be finished of this tween before the next tween of the sequence should be started
staggerTypeThe selected StaggerType which defines what the stagger parameter represents

◆ ResetData()

override void RaTweening.RaTweenSequence.ResetData ( )
protectedvirtual

Reimplemented from RaTweening.RaTweenBase.

◆ SetDefaultValues()

override void RaTweening.RaTweenSequence.SetDefaultValues ( )
protectedvirtual