A template class to create an ITimeline object with key animation capabilities. More...
#include "murl_logic_animation.h"
Public Types | |
using | ValueType = DataType |
The template parameter value type. | |
using | Key = AnimationKey< DataType > |
Type definition of the animation key data type. | |
using | Ptr = SharedPointer< Animation > |
The Animation shared pointer type. | |
Public Member Functions | |
Key & | AddKey (const Key &key) |
Add a key to the animation key array. More... | |
Key & | AddKey (Real time, const DataType &value) |
Add a key to the animation key array with linear interpolation. More... | |
Key & | AddKey (Real time, const DataType &value, IEnums::Interpolation interpolation) |
Add a key to the animation key array. More... | |
Key & | SetKey (SInt32 index, const Key &key) |
Set a key in the animation key array. More... | |
Key & | SetKey (SInt32 index, Real time, const DataType &value) |
Set a key in the animation key array with linear interpolation. More... | |
Key & | SetKey (SInt32 index, Real time, const DataType &value, IEnums::Interpolation interpolation) |
Set a key in the animation key array. More... | |
Key & | InsertKey (SInt32 index, const Key &key) |
Insert a key to the animation key array. More... | |
Key & | InsertKey (SInt32 index, Real time, const DataType &value) |
Insert a key to the animation key array with linear interpolation. More... | |
Key & | InsertKey (SInt32 index, Real time, const DataType &value, IEnums::Interpolation interpolation) |
Insert a key to the animation key array. More... | |
SInt32 | GetNumberOfKeys () const |
Get the number of keys. More... | |
const Key & | GetKey (SInt32 index) const |
Get a key from the animation key array. More... | |
Key & | GetKey (SInt32 index) |
Get a key from the animation key array. More... | |
Bool | ModifyKeyTime (SInt32 index, Real time) |
Modify the time of a key in the animation key array. More... | |
Bool | ModifyKeyValue (SInt32 index, const DataType &value) |
Modify the value of a key in the animation key array. More... | |
Bool | ModifyKeyInterpoation (SInt32 index, IEnums::Interpolation interpolation) |
Modify the interpolation of a key in the animation key array. More... | |
Bool | SetNumberOfKeys (SInt32 n) |
Set the number of keys. More... | |
Bool | RemoveKey (SInt32 index, SInt32 count=1) |
Remove keys at a given position. More... | |
void | EmptyKeys () |
Empty the keys, but keep the underlying storage. | |
void | ClearKeys () |
Clear the keys and remove the underlying storage. | |
void | SetIntermediateKeys (Real midTime, const DataType &midValue, Real endTime, const DataType &endValue, IEnums::Interpolation interpolation) |
Set keys for an intermediate time and value. More... | |
Animation () | |
The default constructor. | |
~Animation () override | |
The destructor. | |
operator IStepablePtr () | |
Conversion operator. More... | |
virtual void | OnEvaluateAnimation (const DataType ¤tValue) |
Called if the current value is set. More... | |
virtual const DataType & | GetCurrentValue () const |
Get the current value. More... | |
virtual Bool | StartForward () |
Start the timeline forward. More... | |
virtual Bool | StartBackward () |
Start the timeline backward. More... | |
virtual Bool | SetStartTimeFromKey (SInt32 index) |
Set the timeline start time from a specified key index. More... | |
virtual Bool | SetEndTimeFromKey (SInt32 index) |
Set the timeline end time from a specified key index. More... | |
virtual Bool | SetLoopStartTimeFromKey (SInt32 index) |
Set the timeline loop start time from a specified key index. More... | |
virtual Bool | SetLoopEndTimeFromKey (SInt32 index) |
Set the timeline loop end time from a specified key index. More... | |
virtual Bool | HasPassedTimeFromKey (SInt32 index) const |
Check if the current time has passed the time from a specified key index. More... | |
virtual Bool | IsOnTimeFromKey (SInt32 index) const |
Check if the current time is the time from a specified key index. More... | |
void | Reset () override |
Reset the animation. | |
Public Member Functions inherited from Murl::Logic::Timeline | |
~Timeline () override | |
The destructor. | |
void | ProcessTick (const Logic::IState *state) override |
Implementation of IStepable::ProcessTick() method. More... | |
IStepablePtr | GetStepable () override |
Implementation of ITimeline::GetStepable() method. More... | |
Bool | SetAppTimeline (IAppTimelinePtr appTimeline) override |
Implementation of ITimeline::SetAppTimeline() method. More... | |
void | Evaluate () override |
Implementation of ITimeline::Evaluate() method. | |
void | Reset () override |
Implementation of ITimeline::Reset() and IStepable::Reset() method. | |
void | ResetTo (Real startTime) override |
Implementation of ITimeline::ResetTo() method. More... | |
Bool | Start () override |
Implementation of ITimeline::Start() method. More... | |
Bool | Start (Real startTime, Real endTime) override |
Implementation of ITimeline::Start(Real startTime, Real endTime) method. More... | |
Bool | Start (Real startTime, Real endTime, SInt32 numberOfLoops) override |
Implementation of ITimeline::Start(Real startTime, Real endTime, SInt32 numberOfLoops) method. More... | |
Bool | Start (Real startTime, Real endTime, Real loopStartTime, Real loopEndTime, SInt32 numberOfLoops) override |
Implementation of ITimeline::Start(Real startTime, Real endTime, Real loopStartTime, Real loopEndTime, SInt32 numberOfLoops) method. More... | |
Bool | Pause () override |
Implementation of ITimeline::Pause() method. More... | |
Bool | Stop () override |
Implementation of ITimeline::Stop() method. More... | |
Bool | Rewind () override |
Implementation of ITimeline::Rewind() method. More... | |
void | SetStartTime (Real startTime) override |
Implementation of ITimeline::SetStartTime() method. More... | |
Real | GetStartTime () const override |
Implementation of ITimeline::GetStartTime() method. More... | |
void | SetEndTime (Real endTime) override |
Implementation of ITimeline::SetEndTime() method. More... | |
Real | GetEndTime () const override |
Implementation of ITimeline::GetEndTime() method. More... | |
void | SetLoopStartTime (Real startTime) override |
Implementation of ITimeline::SetLoopStartTime() method. More... | |
Real | GetLoopStartTime () const override |
Implementation of ITimeline::GetLoopStartTime() method. More... | |
void | SetLoopEndTime (Real endTime) override |
Implementation of ITimeline::SetLoopEndTime() method. More... | |
Real | GetLoopEndTime () const override |
Implementation of ITimeline::GetLoopEndTime() method. More... | |
void | SetNumberOfLoops (SInt32 numberOfLoops) override |
Implementation of ITimeline::SetNumberOfLoops() method. More... | |
SInt32 | GetNumberOfLoops () const override |
Implementation of ITimeline::GetNumberOfLoops() method. More... | |
void | SetTimeScale (Real timeScale) override |
Implementation of ITimeline::SetTimeScale() method. More... | |
Real | GetTimeScale () const override |
Implementation of ITimeline::GetTimeScale() method. More... | |
void | SetAutoRewindEnabled (Bool enabled) override |
Implementation of ITimeline::SetAutoRewindEnabled() method. More... | |
Bool | IsAutoRewindEnabled () const override |
Implementation of ITimeline::IsAutoRewindEnabled() method. More... | |
Bool | IsRunning () const override |
Implementation of ITimeline::IsRunning() method. More... | |
Bool | IsPaused () const override |
Implementation of ITimeline::IsPaused() method. More... | |
Bool | IsStopped () const override |
Implementation of ITimeline::IsStopped() method. More... | |
Bool | WasStarted () const override |
Implementation of ITimeline::WasStarted() method. More... | |
Bool | WasRunning () const override |
Implementation of ITimeline::WasRunning() method. More... | |
Bool | IsOrWasRunning () const override |
Implementation of ITimeline::IsOrWasRunning() method. More... | |
Bool | HasPassedTime (Real time) const override |
Implementation of ITimeline::HasPassedTime() method. More... | |
Bool | HasPassedLoop (SInt32 loop) const override |
Implementation of ITimeline::HasPassedLoop() method. More... | |
Double | GetCurrentTime () const override |
Implementation of ITimeline::GetCurrentTime() method. More... | |
Double | GetRemainingTime () const override |
Implementation of ITimeline::GetRemainingTime() method. More... | |
void | SetCurrentTime (Double time) override |
Implementation of ITimeline::SetCurrentTime() method. More... | |
SInt32 | GetCurrentLoop () const override |
Implementation of ITimeline::GetCurrentLoop() method. More... | |
SInt32 | GetRemainingLoops () const override |
Implementation of ITimeline::GetRemainingLoops() method. More... | |
Bool | SetCurrentLoop (SInt32 loop) override |
Implementation of ITimeline::SetCurrentLoop() method. More... | |
IEnums::AnimationState | GetCurrentState () const override |
Implementation of ITimeline::GetCurrentState() method. More... | |
Public Member Functions inherited from Murl::Logic::Stepable | |
~Stepable () override | |
The destructor. | |
Bool | SetAppStepable (IAppStepablePtr appStepable) override |
Implementation of IStepable::SetAppStepable() method. More... | |
void | SetEnabled (Bool isEnabled) override |
Implementation of IStepable::SetEnabled() method. More... | |
Bool | IsEnabled () const override |
Implementation of IStepable::IsEnabled() method. More... | |
void | FinishTick (const Logic::IState *state) override |
Implementation of IStepable::FinishTick() method. More... | |
Static Public Member Functions | |
static Ptr | Create () |
Create an Animation object. More... | |
Static Public Member Functions inherited from Murl::Logic::Timeline | |
static ITimelinePtr | Create () |
Create a timeline object. More... | |
Static Public Member Functions inherited from Murl::Logic::Stepable | |
static IStepablePtr | Create () |
Create a stepable object. More... | |
Public Attributes | |
Array< Key > | mKeys |
The animation keys array. | |
Protected Member Functions | |
void | OnEvaluate (Double currentTime) override |
Overwrite of the IAppTimeline::OnEvaluate() method. More... | |
Detailed Description
template<class DataType>
class Murl::Logic::Animation< DataType >
A template class to create an ITimeline object with key animation capabilities.
Member Function Documentation
◆ AddKey() [1/3]
|
inline |
Add a key to the animation key array.
- Parameters
-
key The key to copy and add.
- Returns
- The added key.
References Murl::Logic::Animation< DataType >::mKeys.
Referenced by Murl::Logic::SoundFader::SoundFader().
◆ AddKey() [2/3]
|
inline |
Add a key to the animation key array with linear interpolation.
- Parameters
-
time The time for the key in seconds. value The value for the key.
- Returns
- The added key.
References Murl::Logic::Animation< DataType >::mKeys.
◆ AddKey() [3/3]
|
inline |
Add a key to the animation key array.
- Parameters
-
time The time for the key in seconds. value The value for the key. interpolation The interpolation type.
- Returns
- The added key.
References Murl::Logic::Animation< DataType >::mKeys.
◆ SetKey() [1/3]
|
inline |
Set a key in the animation key array.
- Parameters
-
index The zero-based index of the key to set. key The key to copy and set.
- Returns
- The added key.
References Murl::Logic::Animation< DataType >::mKeys.
◆ SetKey() [2/3]
|
inline |
Set a key in the animation key array with linear interpolation.
- Parameters
-
index The zero-based index of the key to set. time The time for the key in seconds. value The value for the key.
- Returns
- The set key.
References Murl::Logic::Animation< DataType >::mKeys.
◆ SetKey() [3/3]
|
inline |
Set a key in the animation key array.
- Parameters
-
index The zero-based index of the key to set. time The time for the key in seconds. value The value for the key. interpolation The interpolation type.
- Returns
- The set key.
References Murl::Logic::Animation< DataType >::mKeys.
◆ InsertKey() [1/3]
|
inline |
Insert a key to the animation key array.
- Parameters
-
index The zero-based index of the key to insert. key The key to copy and insert.
- Returns
- The inserted key.
References Murl::Logic::Animation< DataType >::mKeys.
◆ InsertKey() [2/3]
|
inline |
Insert a key to the animation key array with linear interpolation.
- Parameters
-
index The zero-based index of the key to insert. time The time for the key in seconds. value The value for the key.
- Returns
- The inserted key.
References Murl::Logic::Animation< DataType >::mKeys.
◆ InsertKey() [3/3]
|
inline |
Insert a key to the animation key array.
- Parameters
-
index The zero-based index of the key to insert. time The time for the key in seconds. value The value for the key. interpolation The interpolation type.
- Returns
- The inserted key.
References Murl::Logic::Animation< DataType >::mKeys.
◆ GetNumberOfKeys()
|
inline |
Get the number of keys.
- Returns
- The number of keys.
References Murl::Logic::Animation< DataType >::mKeys.
◆ GetKey() [1/2]
|
inline |
Get a key from the animation key array.
- Parameters
-
index The zero-based index of the key.
- Returns
- The constant key at the specified index.
References Murl::Logic::Animation< DataType >::mKeys.
◆ GetKey() [2/2]
|
inline |
Get a key from the animation key array.
- Parameters
-
index The zero-based index of the key.
- Returns
- The key at the specified index.
References Murl::Logic::Animation< DataType >::mKeys.
◆ ModifyKeyTime()
|
inline |
Modify the time of a key in the animation key array.
- Parameters
-
index The zero-based index of the key to modify. time The time for the key in seconds.
- Returns
- true if successful, false if the index is out of range.
References Murl::Logic::Animation< DataType >::mKeys.
◆ ModifyKeyValue()
|
inline |
Modify the value of a key in the animation key array.
- Parameters
-
index The zero-based index of the key to modify. value The value for the key.
- Returns
- true if successful, false if the index is out of range.
References Murl::Logic::Animation< DataType >::mKeys.
◆ ModifyKeyInterpoation()
|
inline |
Modify the interpolation of a key in the animation key array.
- Parameters
-
index The zero-based index of the key to modify. interpolation The interpolation type.
- Returns
- true if successful, false if the index is out of range.
References Murl::Logic::Animation< DataType >::mKeys.
◆ SetNumberOfKeys()
|
inline |
Set the number of keys.
- Parameters
-
n The number of keys.
- Returns
- true if successful.
References Murl::Logic::Animation< DataType >::mKeys.
◆ RemoveKey()
|
inline |
Remove keys at a given position.
- Parameters
-
index The zero-based index from where to remove the keys. count The number of keys to remove.
- Returns
- true if successful.
References Murl::Logic::Animation< DataType >::mKeys.
◆ SetIntermediateKeys()
|
inline |
Set keys for an intermediate time and value.
Enter an interpolation curve at a variable time with a specified value.
Setup key 0 with start time zero and key 1 with the given end time; the mid value is the value at mid time using the given interpolation.
The keys are typically used with Start(midTime, endTime).
- Parameters
-
midTime The time between zero and the endTime. midValue The value at mid time. endTime The end time. endValue The value at end time. interpolation The interpolation type.
References Murl::Math::Interpolation(), and Murl::Logic::Animation< DataType >::mKeys.
◆ Create()
|
inlinestatic |
Create an Animation object.
- Returns
- The Animation shared pointer.
References Murl::Logic::Animation< DataType >::Animation().
◆ operator IStepablePtr()
|
inline |
Conversion operator.
- Returns
- The IStepable interface.
References Murl::Logic::Timeline::GetStepable().
◆ OnEvaluateAnimation()
|
inlinevirtual |
Called if the current value is set.
This method is empty and can be overwritten.
- Parameters
-
currentValue The current value.
Referenced by Murl::Logic::Animation< DataType >::OnEvaluate().
◆ GetCurrentValue()
|
inlinevirtual |
Get the current value.
- Returns
- The current value.
◆ StartForward()
|
inlinevirtual |
Start the timeline forward.
The first animation array key is the start time, the last animation array key is the end time.
- Returns
- true if successful.
References Murl::Logic::Animation< DataType >::mKeys, and Murl::Logic::Timeline::Start().
Referenced by Murl::Logic::SoundFader::FadeIn().
◆ StartBackward()
|
inlinevirtual |
Start the timeline backward.
The last animation array key is the start time, the first animation array key is the end time.
- Returns
- true if successful.
References Murl::Logic::Animation< DataType >::mKeys, and Murl::Logic::Timeline::Start().
Referenced by Murl::Logic::SoundFader::FadeOut().
◆ SetStartTimeFromKey()
|
inlinevirtual |
Set the timeline start time from a specified key index.
- Parameters
-
index The zero-based index to the mKeys array.
- Returns
- true if successful, false if index is out of range.
References Murl::Logic::Animation< DataType >::mKeys, and Murl::Logic::Timeline::SetStartTime().
◆ SetEndTimeFromKey()
|
inlinevirtual |
Set the timeline end time from a specified key index.
- Parameters
-
index The zero-based index to the mKeys array.
- Returns
- true if successful, false if index is out of range.
References Murl::Logic::Animation< DataType >::mKeys, and Murl::Logic::Timeline::SetEndTime().
◆ SetLoopStartTimeFromKey()
|
inlinevirtual |
Set the timeline loop start time from a specified key index.
- Parameters
-
index The zero-based index to the mKeys array.
- Returns
- true if successful, false if index is out of range.
References Murl::Logic::Animation< DataType >::mKeys, and Murl::Logic::Timeline::SetLoopStartTime().
◆ SetLoopEndTimeFromKey()
|
inlinevirtual |
Set the timeline loop end time from a specified key index.
- Parameters
-
index The zero-based index to the mKeys array.
- Returns
- true if successful, false if index is out of range.
References Murl::Logic::Animation< DataType >::mKeys, and Murl::Logic::Timeline::SetLoopEndTime().
◆ HasPassedTimeFromKey()
|
inlinevirtual |
Check if the current time has passed the time from a specified key index.
Does not consider loops, for evaluating loops see ITimeline::HasPassedLoop().
- Parameters
-
index The zero-based index to the mKeys array.
- Returns
- true if the current time has passed the key time within the most recent tick.
References Murl::Logic::Timeline::HasPassedTime(), and Murl::Logic::Animation< DataType >::mKeys.
◆ IsOnTimeFromKey()
|
inlinevirtual |
Check if the current time is the time from a specified key index.
- Parameters
-
index The zero-based index to the mKeys array.
- Returns
- true if the current time is the key time.
References Murl::Logic::Timeline::GetCurrentTime(), and Murl::Logic::Animation< DataType >::mKeys.
◆ OnEvaluate()
|
inlineoverrideprotectedvirtual |
Overwrite of the IAppTimeline::OnEvaluate() method.
Calculates the current value from the animation keys depending on the current time. OnEvaluateAnimation() is called after evaluation.
- Parameters
-
currentTime The current timeline time.
Implements Murl::Logic::IAppTimeline.
References Murl::Math::Interpolation(), Murl::IEnums::INTERPOLATION_CONSTANT, Murl::Math::Lerp(), Murl::Logic::AnimationKey< DataType >::mInterpolation, Murl::Logic::Animation< DataType >::mKeys, Murl::Logic::AnimationKey< DataType >::mTime, Murl::Logic::AnimationKey< DataType >::mValue, and Murl::Logic::Animation< DataType >::OnEvaluateAnimation().
The documentation for this class was generated from the following file:
- murl_logic_animation.h