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

typedef DataType ValueType
 The template parameter value type. More...
 
typedef AnimationKey< DataType > Key
 Type definition of the animation key data type. More...
 
typedef SharedPointer< AnimationPtr
 The Animation shared pointer type. More...
 

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.
 
virtual ~Animation ()
 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...
 
- Public Member Functions inherited from Murl::Logic::Timeline
virtual ~Timeline ()
 The destructor.
 
virtual void ProcessTick (const Logic::IState *state)
 Implementation of IStepable::ProcessTick() method.
 
virtual IStepablePtr GetStepable ()
 Implementation of ITimeline::GetStepable() method.
 
virtual Bool SetAppTimeline (IAppTimelinePtr appTimeline)
 Implementation of ITimeline::SetAppTimeline() method.
 
virtual void Evaluate ()
 Implementation of ITimeline::Evaluate() method.
 
virtual void Reset ()
 Implementation of ITimeline::Reset() and IStepable::Reset() method.
 
virtual void ResetTo (Real startTime)
 Implementation of ITimeline::ResetTo() method.
 
virtual Bool Start ()
 Implementation of ITimeline::Start() method.
 
virtual Bool Start (Real startTime, Real endTime)
 Implementation of ITimeline::Start(Real startTime, Real endTime) method.
 
virtual Bool Start (Real startTime, Real endTime, SInt32 numberOfLoops)
 Implementation of ITimeline::Start(Real startTime, Real endTime, SInt32 numberOfLoops) method.
 
virtual Bool Start (Real startTime, Real endTime, Real loopStartTime, Real loopEndTime, SInt32 numberOfLoops)
 Implementation of ITimeline::Start(Real startTime, Real endTime, Real loopStartTime, Real loopEndTime, SInt32 numberOfLoops) method.
 
virtual Bool Pause ()
 Implementation of ITimeline::Pause() method.
 
virtual Bool Stop ()
 Implementation of ITimeline::Stop() method.
 
virtual Bool Rewind ()
 Implementation of ITimeline::Rewind() method.
 
virtual void SetStartTime (Real startTime)
 Implementation of ITimeline::SetStartTime() method.
 
virtual Real GetStartTime () const
 Implementation of ITimeline::GetStartTime() method.
 
virtual void SetEndTime (Real endTime)
 Implementation of ITimeline::SetEndTime() method.
 
virtual Real GetEndTime () const
 Implementation of ITimeline::GetEndTime() method.
 
virtual void SetLoopStartTime (Real startTime)
 Implementation of ITimeline::SetLoopStartTime() method.
 
virtual Real GetLoopStartTime () const
 Implementation of ITimeline::GetLoopStartTime() method.
 
virtual void SetLoopEndTime (Real endTime)
 Implementation of ITimeline::SetLoopEndTime() method.
 
virtual Real GetLoopEndTime () const
 Implementation of ITimeline::GetLoopEndTime() method.
 
virtual void SetNumberOfLoops (SInt32 numberOfLoops)
 Implementation of ITimeline::SetNumberOfLoops() method.
 
virtual SInt32 GetNumberOfLoops () const
 Implementation of ITimeline::GetNumberOfLoops() method.
 
virtual void SetTimeScale (Real timeScale)
 Implementation of ITimeline::SetTimeScale() method.
 
virtual Real GetTimeScale () const
 Implementation of ITimeline::GetTimeScale() method.
 
virtual void SetAutoRewindEnabled (Bool enable)
 Implementation of ITimeline::SetAutoRewindEnabled() method.
 
virtual Bool IsAutoRewindEnabled () const
 Implementation of ITimeline::IsAutoRewindEnabled() method.
 
virtual Bool IsRunning () const
 Implementation of ITimeline::IsRunning() method.
 
virtual Bool IsPaused () const
 Implementation of ITimeline::IsPaused() method.
 
virtual Bool IsStopped () const
 Implementation of ITimeline::IsStopped() method.
 
virtual Bool WasStarted () const
 Implementation of ITimeline::WasStarted() method.
 
virtual Bool WasRunning () const
 Implementation of ITimeline::WasRunning() method.
 
virtual Bool IsOrWasRunning () const
 Implementation of ITimeline::IsOrWasRunning() method.
 
virtual Bool HasPassedTime (Real time) const
 Implementation of ITimeline::HasPassedTime() method.
 
virtual Bool HasPassedLoop (SInt32 loop) const
 Implementation of ITimeline::HasPassedLoop() method.
 
virtual Double GetCurrentTime () const
 Implementation of ITimeline::GetCurrentTime() method.
 
virtual Double GetRemainingTime () const
 Implementation of ITimeline::GetRemainingTime() method.
 
virtual void SetCurrentTime (Double time)
 Implementation of ITimeline::SetCurrentTime() method.
 
virtual SInt32 GetCurrentLoop () const
 Implementation of ITimeline::GetCurrentLoop() method.
 
virtual SInt32 GetRemainingLoops () const
 Implementation of ITimeline::GetRemainingLoops() method.
 
virtual Bool SetCurrentLoop (SInt32 loop)
 Implementation of ITimeline::SetCurrentLoop() method.
 
virtual IEnums::AnimationState GetCurrentState () const
 Implementation of ITimeline::GetCurrentState() method.
 
- Public Member Functions inherited from Murl::Logic::Stepable
virtual ~Stepable ()
 The destructor.
 
virtual Bool SetAppStepable (IAppStepablePtr appStepable)
 Implementation of IStepable::SetAppStepable() method.
 
virtual void SetEnabled (Bool isEnabled)
 Implementation of IStepable::SetEnabled() method.
 
virtual Bool IsEnabled () const
 Implementation of IStepable::IsEnabled() method.
 
virtual void FinishTick (const Logic::IState *state)
 Implementation of IStepable::FinishTick() method.
 

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. More...
 

Protected Member Functions

virtual void OnReset ()
 Overwrite of the BaseStepable::OnReset() method. More...
 
virtual void OnEvaluate (Double currentTime)
 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 Typedef Documentation

◆ ValueType

template<class DataType>
typedef DataType Murl::Logic::Animation< DataType >::ValueType

The template parameter value type.

◆ Key

template<class DataType>
typedef AnimationKey<DataType> Murl::Logic::Animation< DataType >::Key

Type definition of the animation key data type.

◆ Ptr

template<class DataType>
typedef SharedPointer<Animation> Murl::Logic::Animation< DataType >::Ptr

The Animation shared pointer type.

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.

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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ GetNumberOfKeys()

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

Get the number of keys.

Returns
The number of keys.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ Create()

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

Create an Animation object.

Returns
The Animation shared pointer.

◆ operator IStepablePtr()

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

Conversion operator.

Returns
The IStepable interface.

◆ 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.

◆ 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.

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.

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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ OnReset()

template<class DataType>
virtual void Murl::Logic::Animation< DataType >::OnReset ( )
inlineprotectedvirtual

Overwrite of the BaseStepable::OnReset() method.

Reset the animation.

Reimplemented in Murl::Logic::SoundFader.

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

◆ OnEvaluate()

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

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
currentTimeThe current timeline time.

Implements Murl::Logic::IAppTimeline.

Member Data Documentation

◆ mKeys


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


Copyright © 2011-2018 Spraylight GmbH.