RaTweening 1.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Properties | List of all members
RaTweening.Lambda.RaTweenLambdaBase< ValueT > Class Template Referenceabstract

This class acts as the base class for all Lambda Tweens
This tween type can SetStartDynamic(bool) to live calculate its start value
This tween type can use SetEndIsDelta(bool) to live calculate its end value
This tween type can use SetDynamicSetupStep(RaTweenDynamicSetupStep) to determine when to calculate the SetStartDynamic(bool) and SetEndIsDelta(bool) values
It allows for a Setter and an optional IsValid check method to be passed to it in order to execute the evaluation of a tween.

‍Note: Lambda Tweens are used to create a tween where you can define the setter logics of the tween yourself in code. (for when you try to do custom logics or the tween does not have a clear target)
Note: Dynamic values don't work well together with modified tween evaluations for they rely heavily on the start and end position being in sequence.

More...

Inheritance diagram for RaTweening.Lambda.RaTweenLambdaBase< ValueT >:
RaTweening.RaTween RaTweening.Lambda.IRaTweenLambda RaTweening.RaTweenBase

Public Member Functions

delegate void SetterHandler (ValueT value, float normalizedValue)
 The Delegate which passes a value and normalized value to determine the setter logics

‍Note: normalizedValue is a value where 0 == Start and 1 == End. This is passed for extra info.

More...
 
delegate bool IsValidHandler ()
 The Delegate which returns true if the tween is valid, and false if the tween should be terminated (Think of null reference prevention)
 
 RaTweenLambdaBase (ValueT start, ValueT end, float duration, SetterHandler setter, IsValidHandler isValidHandler=null)
 
RaTweenLambdaBase< ValueT > SetStartValue (ValueT start)
 This API call Sets the start value of the tween. More...
 
RaTweenLambdaBase< ValueT > SetEndValue (ValueT end)
 This API call Sets the end value of the tween. More...
 
RaTweenLambdaBase< ValueT > SetEndIsDelta (bool enabled=true)
 Makes it so the value set within the end value or reference is calculated as delta at runtime So an end value of 5 while the target is at value 20 would result in a final end value of 25. SetDynamicSetupStep(RaTweenDynamicSetupStep) to see when this value is calculated More...
 
RaTweenLambdaBase< ValueT > SetStartDynamic (bool enabled=true)
 Makes it so the value set within the start value or reference is ignored and rather the value at which the object is at calculation time has is used as start value. SetDynamicSetupStep(RaTweenDynamicSetupStep) to see when this value is calculated More...
 
RaTweenLambdaBase< ValueT > SetDynamicSetupStep (RaTweenDynamicSetupStep step)
 Determines when the SetStartDynamic(bool) and the SetEndIsDelta(bool) are calculated Read RaTweenDynamicSetupStep for the details on the calculation steps

‍Note: When set to RaTweenDynamicSetupStep.Start, it recalculates the values on each loop

More...
 
- Public Member Functions inherited from RaTweening.RaTween
 RaTween (float duration)
 
- 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...
 

Protected Member Functions

override void OnSetup ()
 
override void OnStart ()
 
override void SetDefaultValues ()
 
override void ApplyRewind (bool resumeAfterRewind)
 
override void Evaluate (float normalizedValue)
 
override RaTween RaTweenClone ()
 
override void Dispose ()
 
void WriteValue (ValueT value, float normalizedValue)
 
abstract RaTweenLambdaBase< ValueT > CloneLambdaTween ()
 
abstract ValueT GetEndByDelta (ValueT start, ValueT delta)
 
abstract void LambdaEvaluation (float normalizedValue, ValueT start, ValueT end)
 
- Protected Member Functions inherited from RaTweening.RaTween
abstract RaTween RaTweenClone ()
 
override RaTweenBase CloneSelf ()
 
override void OnSetDuration (float duration)
 
override void SetDefaultValues ()
 
override float CalculateEvaluation ()
 
float ApplyEvaluationModifier (float value)
 
override void ApplyRewind (bool resumeAfterRewind)
 
override void ApplyReset (bool inclDelay)
 
- 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

ValueT Start [get]
 The Value to start the Tween at (in which state it will begin)
 
ValueT End [get]
 The value to end the Tween to (in which state it will result)
 
ValueT Value [get]
 The value which is recorded by the evaluation of the tween (The current value of the imaginary target)
 
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

- Public Types inherited from RaTweening.RaTweenBase
enum  State
 The state in which a tween can be found
 
- 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)


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

Detailed Description

This class acts as the base class for all Lambda Tweens
This tween type can SetStartDynamic(bool) to live calculate its start value
This tween type can use SetEndIsDelta(bool) to live calculate its end value
This tween type can use SetDynamicSetupStep(RaTweenDynamicSetupStep) to determine when to calculate the SetStartDynamic(bool) and SetEndIsDelta(bool) values
It allows for a Setter and an optional IsValid check method to be passed to it in order to execute the evaluation of a tween.

‍Note: Lambda Tweens are used to create a tween where you can define the setter logics of the tween yourself in code. (for when you try to do custom logics or the tween does not have a clear target)
Note: Dynamic values don't work well together with modified tween evaluations for they rely heavily on the start and end position being in sequence.

Member Function Documentation

◆ ApplyRewind()

override void RaTweening.Lambda.RaTweenLambdaBase< ValueT >.ApplyRewind ( bool  resumeAfterRewind)
protectedvirtual

Reimplemented from RaTweening.RaTween.

◆ Dispose()

override void RaTweening.Lambda.RaTweenLambdaBase< ValueT >.Dispose ( )
protectedvirtual

◆ Evaluate()

override void RaTweening.Lambda.RaTweenLambdaBase< ValueT >.Evaluate ( float  normalizedValue)
protectedvirtual

◆ OnSetup()

override void RaTweening.Lambda.RaTweenLambdaBase< ValueT >.OnSetup ( )
protectedvirtual

Reimplemented from RaTweening.RaTweenBase.

◆ OnStart()

override void RaTweening.Lambda.RaTweenLambdaBase< ValueT >.OnStart ( )
protectedvirtual

Reimplemented from RaTweening.RaTweenBase.

◆ RaTweenClone()

override RaTween RaTweening.Lambda.RaTweenLambdaBase< ValueT >.RaTweenClone ( )
protectedvirtual

Implements RaTweening.RaTween.

◆ SetDefaultValues()

override void RaTweening.Lambda.RaTweenLambdaBase< ValueT >.SetDefaultValues ( )
protectedvirtual

Reimplemented from RaTweening.RaTween.

◆ SetDynamicSetupStep()

RaTweenLambdaBase< ValueT > RaTweening.Lambda.RaTweenLambdaBase< ValueT >.SetDynamicSetupStep ( RaTweenDynamicSetupStep  step)

Determines when the SetStartDynamic(bool) and the SetEndIsDelta(bool) are calculated Read RaTweenDynamicSetupStep for the details on the calculation steps

‍Note: When set to RaTweenDynamicSetupStep.Start, it recalculates the values on each loop

Parameters
stepStep on which to calculate dynamic data

◆ SetEndIsDelta()

RaTweenLambdaBase< ValueT > RaTweening.Lambda.RaTweenLambdaBase< ValueT >.SetEndIsDelta ( bool  enabled = true)

Makes it so the value set within the end value or reference is calculated as delta at runtime So an end value of 5 while the target is at value 20 would result in a final end value of 25. SetDynamicSetupStep(RaTweenDynamicSetupStep) to see when this value is calculated

Parameters
enabledtrue to enable this feature, false to disable it

◆ SetEndValue()

RaTweenLambdaBase< ValueT > RaTweening.Lambda.RaTweenLambdaBase< ValueT >.SetEndValue ( ValueT  end)

This API call Sets the end value of the tween.

Parameters
endThe value to tween to

◆ SetStartDynamic()

RaTweenLambdaBase< ValueT > RaTweening.Lambda.RaTweenLambdaBase< ValueT >.SetStartDynamic ( bool  enabled = true)

Makes it so the value set within the start value or reference is ignored and rather the value at which the object is at calculation time has is used as start value. SetDynamicSetupStep(RaTweenDynamicSetupStep) to see when this value is calculated

Parameters
enabledtrue to enable this feature, false to disable it

◆ SetStartValue()

RaTweenLambdaBase< ValueT > RaTweening.Lambda.RaTweenLambdaBase< ValueT >.SetStartValue ( ValueT  start)

This API call Sets the start value of the tween.

Parameters
startThe value to tween from

◆ SetterHandler()

delegate void RaTweening.Lambda.RaTweenLambdaBase< ValueT >.SetterHandler ( ValueT  value,
float  normalizedValue 
)

The Delegate which passes a value and normalized value to determine the setter logics

‍Note: normalizedValue is a value where 0 == Start and 1 == End. This is passed for extra info.

Parameters
valueThe current evaluation value of the tween which should be set
normalizedValueValue where 0 == Start and 1 == End. This is passed for extra info.