![]() |
Lysa
0.0
Lysa 3D Engine
|
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 Typedefs | |
| typedef void (Object::* | Setter) (const T &) |
Public Typedefs inherited from Tween | |
| using | Callback = std::function< void ()> |
Public Member Functions | |
| PropertyTween (Object *obj, const Setter set, T initial, T final, const float duration, const TransitionType ttype=TransitionType::LINEAR, const Callback &callback=nullptr) | |
| PropertyTween (const std::shared_ptr< Object > &obj, const Setter set, T initial, T final, const float duration, const TransitionType ttype=TransitionType::LINEAR, const Callback &callback=nullptr) | |
| bool | update (const float deltaTime) override |
Public Member Functions inherited from Tween | |
| auto | isRunning () const |
| void | kill () |
Public Member Functions inherited from Object | |
| void | connect (const Signal::signal &name, const Signal::Handler &handler) |
| void | connect (const Signal::signal &name, const std::function< void ()> &handler) |
| void | emit (const Signal::signal &name, void *params=nullptr) |
| virtual std::string | toString () const |
| Object () = default | |
| virtual | ~Object () = default |
Additional Inherited Members | |
Protected Member Functions inherited from Tween | |
| Tween (const TransitionType type, const Callback &callback) | |
Protected Attributes inherited from Tween | |
| bool | running {false} |
| Callback | callback |
| TransitionType | interpolationType |
| typedef void(Object::* Setter) (const T &) |
Pointer-to-member setter method called every update. The signature must accept a const T&.
|
inline |
Creates a tween that interpolates a property on an Object.
| obj | Target object whose property will be animated. |
| set | Member setter to call on the target object. |
| initial | Starting value applied at time 0. |
| final | Target value reached at the end of the duration. |
| duration | Animation duration in seconds (must be > 0). |
| ttype | Interpolation curve to use (default: LINEAR). |
| callback | Optional function invoked when the tween completes. |
|
inline |
Creates a tween that interpolates a property on an Object. This overload accepts a shared_ptr to the target; the pointer is not retained beyond construction (the raw pointer is stored), so callers must ensure the target outlives the tween.
| obj | Shared pointer to the target object. |
| set | Member setter to call on the target object. |
| initial | Starting value applied at time 0. |
| final | Target value reached at the end of the duration. |
| duration | Animation duration in seconds (must be > 0). |
| ttype | Interpolation curve to use (default: LINEAR). |
| callback | Optional function invoked when the tween completes. |
|
inlineoverridevirtual |
Interpolates the property and applies the new value through the setter.
If the tween was created manually, call this from a Node::onPhysicsProcess() function. Do not call it if the tween was created with Node::createPropertyTween().
| deltaTime | Time elapsed since the previous update (seconds). |
Implements lysa::Tween::update()