![]() |
Lysa
0.0
Lysa 3D Engine
|
Base class for time-based animations (tweens). Tweens encapsulate a small, focused animation task that progresses with time, typically driven every physics tick. Common examples include interpolating a property value on a target Object over a given duration, then optionally invoking a completion callback.
Usage:
Notes:
false once the animation completes. The update() method conventionally returns true when the tween is finished and false while it is still running.
Inheritance diagram for Tween:Public Typedefs | |
| using | Callback = std::function< void ()> |
Public Member Functions | |
| virtual bool | update (float deltaTime) = 0 |
| 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 |
Protected Member Functions | |
| Tween (const TransitionType type, const Callback &callback) | |
Protected Attributes | |
| bool | running {false} |
| Callback | callback |
| TransitionType | interpolationType |
|
inlineprotected |
Constructs a tween with the given interpolation type and optional callback.
| type | Interpolation curve. |
| callback | Function invoked on completion (may be nullptr). |
|
inline |
Returns true while the tween is still animating.
|
inline |
Immediately stops the tween without firing the completion callback.
|
pure virtual |
Advances the tween by delta time.
Call this from Node::onPhysicsProcess() when the tween has been created manually. Do not call it for tweens created via Node::create*Tween(), as they are advanced by the engine.
| deltaTime | Time elapsed since the previous update (seconds). |
Implemented in lysa::PropertyTween::update()
|
protected |
Optional completion callback invoked when the tween ends naturally.
|
protected |
Interpolation curve applied by the tween (e.g., linear, ease-in/out).
|
protected |
True while the tween is active. Set to false upon completion or kill().