SLProject 4.0.000
SLAnimPlayback Class Reference

Manages the playback of an SLAnimation. More...

#include <SLAnimPlayback.h>

Public Member Functions

 SLAnimPlayback (SLAnimation *parent, SLfloat weight=1.0f)
 
void playForward ()
 
void playBackward ()
 
void pause ()
 
void skipToNextKeyframe ()
 
void skipToPrevKeyframe ()
 
void skipToStart ()
 
void skipToEnd ()
 
SLfloat localTime () const
 
SLAnimationparentAnimation ()
 
SLfloat playbackRate () const
 
SLfloat weight () const
 
SLAnimLooping loop () const
 
SLbool enabled () const
 
SLEasingCurve easing () const
 
SLbool changed () const
 
SLbool isPlayingForward () const
 
SLbool isPlayingBackward () const
 
SLbool isPaused () const
 
SLbool isStopped () const
 
void localTime (SLfloat time)
 
void playbackRate (SLfloat pr)
 
void weight (SLfloat weight)
 
void loop (SLAnimLooping lb)
 
void enabled (SLbool val)
 
void easing (SLEasingCurve ec)
 
void changed (SLbool changed)
 
void advanceTime (SLfloat delta)
 
SLfloat calcEasingTime (SLfloat time) const
 Applies the easing time curve to the input time. More...
 
SLfloat calcEasingTimeInv (SLfloat time) const
 

Protected Attributes

SLAnimation_animation
 the animation this plays is referencing More...
 
SLfloat _localTime
 the current local timestamp (eased time) More...
 
SLfloat _weight
 the current weight More...
 
SLfloat _playbackRate
 the current playback speed More...
 
SLshort _playbackDir
 the current playback direction More...
 
SLbool _enabled
 is this animation running More...
 
SLEasingCurve _easing
 easing modifier curve (to customize start and end point easing) More...
 
SLfloat _linearLocalTime
 linear local time used for _easing propert More...
 
SLAnimLooping _loopingBehaviour
 We support different looping behaviours. More...
 
SLbool _gotChanged
 Did this playback change in the last frame. More...
 

Detailed Description

Manages the playback of an SLAnimation.

This class manages the playback state and the local time of an SLAnimation. It manages the way the time advances and how the animation loops. It has all functionality to play, pause, stop, enable, speedup and slowdown a playback. A list of all SLAnimPlayback is hold by the SLAnimManager.

It is possible to have multiple playbacks per animation. If we keep track of which nodes are affected by which SLAnimPlayback we can only manipulate these nodes for the time kept in the SLAnimPlayback. A practical example for this behaviour would be special skeleton instances that only keep track of SLAnimPlayback for their parent SLAnimSkeleton. The skeleton instance can then change its skeletal data based on the states and the actual SLAnimation has to only exist once in memory.

Constructor & Destructor Documentation

◆ SLAnimPlayback()

SLAnimPlayback::SLAnimPlayback ( SLAnimation parent,
SLfloat  weight = 1.0f 
)

Constructor

Member Function Documentation

◆ advanceTime()

void SLAnimPlayback::advanceTime ( SLfloat  delta)

Advances the time of the playback play based on its different easing parameters.

◆ calcEasingTime()

SLfloat SLAnimPlayback::calcEasingTime ( SLfloat  time) const

Applies the easing time curve to the input time.

See also the declaration of the SLEasingCurve enumeration for the different easing curve type that are taken from Qt QAnimation and QEasingCurve class. See http://qt-project.org/doc/qt-4.8/qeasingcurve.html#Type-enum

◆ calcEasingTimeInv()

SLfloat SLAnimPlayback::calcEasingTimeInv ( SLfloat  time) const

Inverse functions for the above easing curve functions.

◆ changed() [1/2]

SLbool SLAnimPlayback::changed ( ) const
inline

◆ changed() [2/2]

void SLAnimPlayback::changed ( SLbool  changed)
inline

◆ easing() [1/2]

SLEasingCurve SLAnimPlayback::easing ( ) const
inline

◆ easing() [2/2]

void SLAnimPlayback::easing ( SLEasingCurve  ec)
inline

◆ enabled() [1/2]

SLbool SLAnimPlayback::enabled ( ) const
inline

◆ enabled() [2/2]

void SLAnimPlayback::enabled ( SLbool  val)
inline

◆ isPaused()

SLbool SLAnimPlayback::isPaused ( ) const
inline

◆ isPlayingBackward()

SLbool SLAnimPlayback::isPlayingBackward ( ) const
inline

◆ isPlayingForward()

SLbool SLAnimPlayback::isPlayingForward ( ) const
inline

◆ isStopped()

SLbool SLAnimPlayback::isStopped ( ) const
inline

◆ localTime() [1/2]

SLfloat SLAnimPlayback::localTime ( ) const
inline

◆ localTime() [2/2]

void SLAnimPlayback::localTime ( SLfloat  time)

Setter for the local time parameter. Takes the currently active easing curve into consideration.

◆ loop() [1/2]

SLAnimLooping SLAnimPlayback::loop ( ) const
inline

◆ loop() [2/2]

void SLAnimPlayback::loop ( SLAnimLooping  lb)
inline

◆ parentAnimation()

SLAnimation * SLAnimPlayback::parentAnimation ( )
inline

◆ pause()

void SLAnimPlayback::pause ( )

Set this playback to be paused.

◆ playbackRate() [1/2]

SLfloat SLAnimPlayback::playbackRate ( ) const
inline

◆ playbackRate() [2/2]

void SLAnimPlayback::playbackRate ( SLfloat  pr)
inline

◆ playBackward()

void SLAnimPlayback::playBackward ( )

Set this playback to be playing backward.

◆ playForward()

void SLAnimPlayback::playForward ( )

Set this playback to be playing forward.

◆ skipToEnd()

void SLAnimPlayback::skipToEnd ( )

Set the local time of this animation to the end time.

◆ skipToNextKeyframe()

void SLAnimPlayback::skipToNextKeyframe ( )

Set the local time of this playback to be on the time of the next keyframe.

◆ skipToPrevKeyframe()

void SLAnimPlayback::skipToPrevKeyframe ( )

Set the local time of this playback to be on the time of the previous keyframe.

◆ skipToStart()

void SLAnimPlayback::skipToStart ( )

Set the local time of this playback to the starting time.

◆ weight() [1/2]

SLfloat SLAnimPlayback::weight ( ) const
inline

◆ weight() [2/2]

void SLAnimPlayback::weight ( SLfloat  weight)
inline

Member Data Documentation

◆ _animation

SLAnimation* SLAnimPlayback::_animation
protected

the animation this plays is referencing

◆ _easing

SLEasingCurve SLAnimPlayback::_easing
protected

easing modifier curve (to customize start and end point easing)

◆ _enabled

SLbool SLAnimPlayback::_enabled
protected

is this animation running

◆ _gotChanged

SLbool SLAnimPlayback::_gotChanged
protected

Did this playback change in the last frame.

◆ _linearLocalTime

SLfloat SLAnimPlayback::_linearLocalTime
protected

linear local time used for _easing propert

◆ _localTime

SLfloat SLAnimPlayback::_localTime
protected

the current local timestamp (eased time)

◆ _loopingBehaviour

SLAnimLooping SLAnimPlayback::_loopingBehaviour
protected

We support different looping behaviours.

◆ _playbackDir

SLshort SLAnimPlayback::_playbackDir
protected

the current playback direction

◆ _playbackRate

SLfloat SLAnimPlayback::_playbackRate
protected

the current playback speed

◆ _weight

SLfloat SLAnimPlayback::_weight
protected

the current weight


The documentation for this class was generated from the following files: