Lysa  0.0
Lysa 3D Engine
PropertyTween< T > Class Template Reference

Detailed Description

template<typename T>
class lysa::PropertyTween< T >

Tween that interpolates a property of an Object via a setter function.

The template parameter T is the property value type (e.g., float, float3). Each update computes the interpolated value and calls the provided setter on the target object. When the duration elapses, the Tween stops and the optional completion callback is invoked.

+ Inheritance diagram for PropertyTween< T >:

Public Member Functions

template<typename O >
 PropertyTween (O *obj, void (O::*set)(const T &), T initial, T final, const float duration, const TransitionType ttype=TransitionType::LINEAR, const Callback &callback=nullptr)
 
bool update (const double deltaTime) override
 
double getOverflow () const override
 
- Public Member Functions inherited from Tween
virtual bool isRunning () const
 
virtual void kill ()
 
virtual ~Tween () = default
 

Additional Inherited Members

- Public Typedefs inherited from Tween
using Callback = std::function< void ()>
 
- Protected Member Functions inherited from Tween
 Tween (const TransitionType type, const Callback &callback)
 
- Static Protected Member Functions inherited from Tween
static double applyEase (TransitionType type, double t)
 
- Protected Attributes inherited from Tween
bool running {false}
 
Callback callback
 
TransitionType interpolationType
 

Constructor & Destructor Documentation

PropertyTween ( O *  obj,
void (O::*)(const T &)  set,
initial,
final,
const float  duration,
const TransitionType  ttype = TransitionType::LINEAR,
const Callback callback = nullptr 
)
inline

Creates a Tween that interpolates a property on an Object. 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.

Member Function Documentation

double getOverflow ( ) const
inlineoverridevirtual

Returns the time that overflowed past the end of this Tween (>= 0).

Reimplemented from lysa::Tween::getOverflow()

bool update ( const double  deltaTime)
inlineoverridevirtual

Advances the Tween by delta time.

Parameters
deltaTimeTime elapsed since the previous update (seconds).
Returns
true when the Tween has finished, false while it is running.

Implements lysa::Tween::update()