A template class to create an ITimeline object with key animation capabilities. More...

#include "murl_logic_animation.h"

Inheritance diagram for Murl::Logic::Animation< DataType >:

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

KeyAddKey (const Key &key)
 Add a key to the animation key array. More...
 
KeyAddKey (Real time, const DataType &value)
 Add a key to the animation key array with linear interpolation. More...
 
KeyAddKey (Real time, const DataType &value, IEnums::Interpolation interpolation)
 Add a key to the animation key array. More...
 
KeySetKey (SInt32 index, const Key &key)
 Set a key in the animation key array. More...
 
KeySetKey (SInt32 index, Real time, const DataType &value)
 Set a key in the animation key array with linear interpolation. More...
 
KeySetKey (SInt32 index, Real time, const DataType &value, IEnums::Interpolation interpolation)
 Set a key in the animation key array. More...
 
KeyInsertKey (SInt32 index, const Key &key)
 Insert a key to the animation key array. More...
 
KeyInsertKey (SInt32 index, Real time, const DataType &value)
 Insert a key to the animation key array with linear interpolation. More...
 
KeyInsertKey (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 KeyGetKey (SInt32 index) const
 Get a key from the animation key array. More...
 
KeyGetKey (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 &currentValue)
 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< KeymKeys
 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]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::AddKey ( const Key key)
inline

Add a key to the animation key array.

Parameters
keyThe key to copy and add.
Returns
The added key.

References Murl::Logic::Animation< DataType >::mKeys.

Referenced by Murl::Logic::SoundFader::SoundFader().

◆ AddKey() [2/3]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::AddKey ( Real  time,
const DataType &  value 
)
inline

Add a key to the animation key array with linear interpolation.

Parameters
timeThe time for the key in seconds.
valueThe value for the key.
Returns
The added key.

References Murl::Logic::Animation< DataType >::mKeys.

◆ AddKey() [3/3]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::AddKey ( Real  time,
const DataType &  value,
IEnums::Interpolation  interpolation 
)
inline

Add a key to the animation key array.

Parameters
timeThe time for the key in seconds.
valueThe value for the key.
interpolationThe interpolation type.
Returns
The added key.

References Murl::Logic::Animation< DataType >::mKeys.

◆ SetKey() [1/3]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::SetKey ( SInt32  index,
const Key key 
)
inline

Set a key in the animation key array.

Parameters
indexThe zero-based index of the key to set.
keyThe key to copy and set.
Returns
The added key.

References Murl::Logic::Animation< DataType >::mKeys.

◆ SetKey() [2/3]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::SetKey ( SInt32  index,
Real  time,
const DataType &  value 
)
inline

Set a key in the animation key array with linear interpolation.

Parameters
indexThe zero-based index of the key to set.
timeThe time for the key in seconds.
valueThe value for the key.
Returns
The set key.

References Murl::Logic::Animation< DataType >::mKeys.

◆ SetKey() [3/3]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::SetKey ( SInt32  index,
Real  time,
const DataType &  value,
IEnums::Interpolation  interpolation 
)
inline

Set a key in the animation key array.

Parameters
indexThe zero-based index of the key to set.
timeThe time for the key in seconds.
valueThe value for the key.
interpolationThe interpolation type.
Returns
The set key.

References Murl::Logic::Animation< DataType >::mKeys.

◆ InsertKey() [1/3]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::InsertKey ( SInt32  index,
const Key key 
)
inline

Insert a key to the animation key array.

Parameters
indexThe zero-based index of the key to insert.
keyThe key to copy and insert.
Returns
The inserted key.

References Murl::Logic::Animation< DataType >::mKeys.

◆ InsertKey() [2/3]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::InsertKey ( SInt32  index,
Real  time,
const DataType &  value 
)
inline

Insert a key to the animation key array with linear interpolation.

Parameters
indexThe zero-based index of the key to insert.
timeThe time for the key in seconds.
valueThe value for the key.
Returns
The inserted key.

References Murl::Logic::Animation< DataType >::mKeys.

◆ InsertKey() [3/3]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::InsertKey ( SInt32  index,
Real  time,
const DataType &  value,
IEnums::Interpolation  interpolation 
)
inline

Insert a key to the animation key array.

Parameters
indexThe zero-based index of the key to insert.
timeThe time for the key in seconds.
valueThe value for the key.
interpolationThe interpolation type.
Returns
The inserted key.

References Murl::Logic::Animation< DataType >::mKeys.

◆ GetNumberOfKeys()

template<class DataType >
SInt32 Murl::Logic::Animation< DataType >::GetNumberOfKeys ( ) const
inline

Get the number of keys.

Returns
The number of keys.

References Murl::Logic::Animation< DataType >::mKeys.

◆ GetKey() [1/2]

template<class DataType >
const Key& Murl::Logic::Animation< DataType >::GetKey ( SInt32  index) const
inline

Get a key from the animation key array.

Parameters
indexThe zero-based index of the key.
Returns
The constant key at the specified index.

References Murl::Logic::Animation< DataType >::mKeys.

◆ GetKey() [2/2]

template<class DataType >
Key& Murl::Logic::Animation< DataType >::GetKey ( SInt32  index)
inline

Get a key from the animation key array.

Parameters
indexThe zero-based index of the key.
Returns
The key at the specified index.

References Murl::Logic::Animation< DataType >::mKeys.

◆ ModifyKeyTime()

template<class DataType >
Bool Murl::Logic::Animation< DataType >::ModifyKeyTime ( SInt32  index,
Real  time 
)
inline

Modify the time of a key in the animation key array.

Parameters
indexThe zero-based index of the key to modify.
timeThe 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()

template<class DataType >
Bool Murl::Logic::Animation< DataType >::ModifyKeyValue ( SInt32  index,
const DataType &  value 
)
inline

Modify the value of a key in the animation key array.

Parameters
indexThe zero-based index of the key to modify.
valueThe value for the key.
Returns
true if successful, false if the index is out of range.

References Murl::Logic::Animation< DataType >::mKeys.

◆ ModifyKeyInterpoation()

template<class DataType >
Bool Murl::Logic::Animation< DataType >::ModifyKeyInterpoation ( SInt32  index,
IEnums::Interpolation  interpolation 
)
inline

Modify the interpolation of a key in the animation key array.

Parameters
indexThe zero-based index of the key to modify.
interpolationThe interpolation type.
Returns
true if successful, false if the index is out of range.

References Murl::Logic::Animation< DataType >::mKeys.

◆ SetNumberOfKeys()

template<class DataType >
Bool Murl::Logic::Animation< DataType >::SetNumberOfKeys ( SInt32  n)
inline

Set the number of keys.

Parameters
nThe number of keys.
Returns
true if successful.

References Murl::Logic::Animation< DataType >::mKeys.

◆ RemoveKey()

template<class DataType >
Bool Murl::Logic::Animation< DataType >::RemoveKey ( SInt32  index,
SInt32  count = 1 
)
inline

Remove keys at a given position.

Parameters
indexThe zero-based index from where to remove the keys.
countThe number of keys to remove.
Returns
true if successful.

References Murl::Logic::Animation< DataType >::mKeys.

◆ SetIntermediateKeys()

template<class DataType >
void Murl::Logic::Animation< DataType >::SetIntermediateKeys ( Real  midTime,
const DataType &  midValue,
Real  endTime,
const DataType &  endValue,
IEnums::Interpolation  interpolation 
)
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
midTimeThe time between zero and the endTime.
midValueThe value at mid time.
endTimeThe end time.
endValueThe value at end time.
interpolationThe interpolation type.

References Murl::Math::Interpolation(), and Murl::Logic::Animation< DataType >::mKeys.

◆ Create()

template<class DataType >
static Ptr Murl::Logic::Animation< DataType >::Create ( )
inlinestatic

Create an Animation object.

Returns
The Animation shared pointer.

References Murl::Logic::Animation< DataType >::Animation().

◆ operator IStepablePtr()

template<class DataType >
Murl::Logic::Animation< DataType >::operator IStepablePtr ( )
inline

Conversion operator.

Returns
The IStepable interface.

References Murl::Logic::Timeline::GetStepable().

◆ OnEvaluateAnimation()

template<class DataType >
virtual void Murl::Logic::Animation< DataType >::OnEvaluateAnimation ( const DataType &  currentValue)
inlinevirtual

Called if the current value is set.

This method is empty and can be overwritten.

Parameters
currentValueThe current value.

Referenced by Murl::Logic::Animation< DataType >::OnEvaluate().

◆ GetCurrentValue()

template<class DataType >
virtual const DataType& Murl::Logic::Animation< DataType >::GetCurrentValue ( ) const
inlinevirtual

Get the current value.

Returns
The current value.

◆ StartForward()

template<class DataType >
virtual Bool Murl::Logic::Animation< DataType >::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()

template<class DataType >
virtual Bool Murl::Logic::Animation< DataType >::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()

template<class DataType >
virtual Bool Murl::Logic::Animation< DataType >::SetStartTimeFromKey ( SInt32  index)
inlinevirtual

Set the timeline start time from a specified key index.

Parameters
indexThe 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()

template<class DataType >
virtual Bool Murl::Logic::Animation< DataType >::SetEndTimeFromKey ( SInt32  index)
inlinevirtual

Set the timeline end time from a specified key index.

Parameters
indexThe 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()

template<class DataType >
virtual Bool Murl::Logic::Animation< DataType >::SetLoopStartTimeFromKey ( SInt32  index)
inlinevirtual

Set the timeline loop start time from a specified key index.

Parameters
indexThe 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()

template<class DataType >
virtual Bool Murl::Logic::Animation< DataType >::SetLoopEndTimeFromKey ( SInt32  index)
inlinevirtual

Set the timeline loop end time from a specified key index.

Parameters
indexThe 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()

template<class DataType >
virtual Bool Murl::Logic::Animation< DataType >::HasPassedTimeFromKey ( SInt32  index) const
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
indexThe 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()

template<class DataType >
virtual Bool Murl::Logic::Animation< DataType >::IsOnTimeFromKey ( SInt32  index) const
inlinevirtual

Check if the current time is the time from a specified key index.

Parameters
indexThe 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()

template<class DataType >
void Murl::Logic::Animation< DataType >::OnEvaluate ( Double  currentTime)
inlineoverrideprotectedvirtual

The documentation for this class was generated from the following file:
  • murl_logic_animation.h


Copyright © 2011-2022 Spraylight GmbH.