Lysa  0.0
Lysa 3D Engine
Tweens Class Reference

Detailed Description

Global Tween registry and factory.

Public Member Functions

virtual ~Tweens ()
 
void cleanup ()
 
std::shared_ptr< TweenregisterTween (const std::shared_ptr< Tween > &tween)
 
std::shared_ptr< TweenSequencesequence (std::vector< std::shared_ptr< Tween >> tweens, const Tween::Callback &callback=nullptr)
 
template<typename T , typename O >
std::shared_ptr< Tweenproperty (O *obj, void (O::*set)(const T &), T initial, T final, const float duration, const TransitionType ttype=TransitionType::LINEAR, const Tween::Callback &callback=nullptr)
 
void update (double deltaTime)
 

Constructor & Destructor Documentation

virtual ~Tweens ( )
virtual

Kills every Tween still registered.

Member Function Documentation

void cleanup ( )
std::shared_ptr<Tween> property ( O *  obj,
void (O::*)(const T &)  set,
initial,
final,
const float  duration,
const TransitionType  ttype = TransitionType::LINEAR,
const Tween::Callback callback = nullptr 
)
inline

Creates a PropertyTween that interpolates a property on an Object, registers it, and returns it. The target object must outlive the Tween.

Parameters
objThe target object.
setMember setter to call on the target object.
initialStarting value applied at time 0.
finalTarget value reached at the end of the duration.
durationAnimation duration in seconds (must be > 0).
ttypeInterpolation curve to use (default: LINEAR).
callbackOptional function invoked when the Tween completes.
std::shared_ptr<Tween> registerTween ( const std::shared_ptr< Tween > &  tween)

Registers a Tween for automatic update each physics ticks

Returns
The same tween, for chaining.
std::shared_ptr<TweenSequence> sequence ( std::vector< std::shared_ptr< Tween >>  tweens,
const Tween::Callback callback = nullptr 
)

Creates a TweenSequence, registers it, and returns it.

Parameters
tweensOrdered list of Tweens; ownership is transferred.
callbackOptional function invoked when the last Tween completes.
void update ( double  deltaTime)

Advances all registered Tweens and removes completed ones.