![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GUI/Animations.h>
Base interface for managing and dispatching animations. More...
Inheritance diagram for AnimationBackendBase:Base interface for managing and dispatching animations.
This abstract base class will only take care of bookkeeping and implementing the logic for setEnabled() and setAnimationDurationFactor(). The actual dispatching and calling of Animation::update() at regular time intervals with the interpolated progress value t has to be implemented by the derived classes.
The dispatching of new animations can be temporarily disabled by calling setEnabled(false). Furthermore, you can configure a global multiplier applied to the animation duration so that you can change the speed of all dispatched animations consistently.
Public Member Functions | |
| void | run (std::shared_ptr< Animation > animation, const std::optional< UniqueId > &uniqueId=std::nullopt) |
| Dispatches the given animation canceling any running animation with the same ID if applicable. | |
| void | cancelAllAnimations () |
| Cancels all animations currently in flight. | |
| bool | isEnabled () const |
| Returns the flag whether dispatching of new animations is enabled. | |
| void | setEnabled (bool value) |
| Sets the flag whether dispatching of new animations is enabled. | |
| double | animationDurationFactor () const |
| Returns the duration multiplier for run animations; enables you to change the speed of all animations consistently. | |
| void | setAnimationDurationFactor (double value) |
| Sets the duration multiplier for run animations, must be >= 0; enables you to change the speed of all animations consistently. | |
Public Member Functions inherited from SignalReceiver | |
| SignalReceiver ()=default | |
| Default constructor. | |
| SignalReceiver (const SignalReceiver &other) | |
| Copy constructor, does not copy any existing signal connections from other. | |
| SignalReceiver & | operator= (SignalReceiver rhs) |
| Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs. | |
| virtual | ~SignalReceiver () |
| Virtual destructor disconnects from all connected signals. | |
Protected Member Functions | |
| virtual void | runImpl (std::shared_ptr< Animation > animation)=0 |
| Called by the base interface once animation is fully configured and ready to dispatch. | |
| void | setAnimationState (Animation &animation, Animation::State newState) const |
Protected Member Functions inherited from SignalReceiver | |
| void | disconnectAll () |
| Disconnects all existing connections. | |
| void run | ( | std::shared_ptr< Animation > | animation, |
| const std::optional< UniqueId > & | uniqueId = std::nullopt ) |
Dispatches the given animation canceling any running animation with the same ID if applicable.
If isEnabled() is false the animation will not be dispatched but its update function will be called once with t = 1.0 so that the animation reaches its final state immediately.
| animation | Animation to execute, must not be null. |
| uniqueId | Optional identifier for this animation to prevent multiple concurrent animations of the same ID. If not empty, the backend will cancel any running animations with the same ID before starting the new one. Make sure to use a sufficiently unique ID to avoid conflicts with other users of this interface. |
|
protectedpure virtual |
Called by the base interface once animation is fully configured and ready to dispatch.
Derived classes must take care of actually dispatching the animation so that the interface invariants are met.
Implemented in AnimationBackendDummy, and AnimationBackendQt.