All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
MultiWidgets::FadeAnimator Class Reference

Animator for implementing fade-ins and fade-outs. More...

#include <MultiWidgets/FadeAnimator.hpp>

Inheritance diagram for MultiWidgets::FadeAnimator:
MultiWidgets::AnimatorT< float > MultiWidgets::Animator MultiWidgets::Operator Stylish::Styleable Valuable::Node Valuable::Attribute Patterns::NotCopyable Valuable::Serializable

Static Public Member Functions

static void fadeIn (MultiWidgets::Widget &w, float duration, float predelay=0.0f)
 Apply a fade-in animation to given widget with the given duration.
 
static void fadeOut (MultiWidgets::Widget &w, float duration, float predelay=0.0f)
 Apply a fade-out animation to given widget with the given duration.
 
static void fadeOutAndDelete (MultiWidgets::Widget &w, float duration, float predelay=0.0f)
 Apply a fade-out animation and delete the given widget. More...
 
static void fadeOutAndHide (MultiWidgets::Widget &w, float duration, float predelay=0.0f)
 Apply a fade-out animation and hide the given widget. More...
 

Additional Inherited Members

- Public Types inherited from MultiWidgets::Animator
enum  Flags {
  NONE = 0, QUIT_ON_INTERACTION = 1, WAIT_READY = 1 << 1, CYCLIC = 1 << 2,
  KEEP_ALIVE_AFTER_ANIMATION = 1 << 3
}
 Animator flags. More...
 
- Valuable Attributes inherited from MultiWidgets::Operator
bool done = false
 Is the operator done (i.e. More...
 
- Node Events inherited from Stylish::Styleable
[OUT] pseudo-class-changed (QString name, bool state)
 Pseudo class name was added (state == true) or removed (state == false)
 
- Public Member Functions inherited from MultiWidgets::AnimatorT< float >
virtual void added (MultiWidgets::Widget &w)
 Called when the animator is added to widget. More...
 
void addKey (float secondsFromPrev, const float &value)
 Append new key-frame. More...
 
 AnimatorT (const QString &param=QString(), Radiant::FlagsT< Flags > flags=NONE)
 Constructs a new animator for the given parameter. More...
 
void bouncyAnimation (float time, const float &from, const float &to, int points=100)
 Creates a boyncy animation from one value to another. More...
 
void clear ()
 Clears all the keypoints After this call there are no keypoints left. More...
 
void copyKeys (const AnimatorT &from)
 Copy key-frames from another animator. More...
 
Radiant::FlagsT< Flagsflags () const
 Get the flags that control the behavior of this animator. More...
 
bool hasAnimationStarted () const
 
bool hasFlag (Radiant::FlagsT< Flags > flag) const
 Check if a flag exists. More...
 
Key< float > & key (size_t i)
 Returns a reference to a given key-point. More...
 
size_t numKeys () const
 Get the number of key-frames. More...
 
const QString & parameter () const
 Returns the name of the parameter to be animated. More...
 
void prependKey (float secondsToNext, const float &value)
 Prepend new key-frame Adds a key-frame to the beginning of the animation. More...
 
virtual void reset ()
 Resets the animation to the beginning.
 
void setElapsed (float seconds)
 Sets the elapsed time.
 
void setFlags (Radiant::FlagsT< Flags > flags)
 Sets the flags for this animator. More...
 
void setParameterName (const QString &param)
 Sets the name for the value to be animated. More...
 
void smoothAnimation (float time, const float &from, const float &to, int points=100)
 Create a smooth animation between two control points This function implements a soft beginning and ending in the animation. More...
 
void smoothBeginAnimation (float time, const float &from, const float &to, int points=100)
 Create an animation with smooth start between two control points This function implements a soft start, and an instant end in the animation. More...
 
void smoothEndAnimation (float time, const float &from, const float &to, int points=100)
 Create an animation with smooth end between two control points This function implements an instant start and soft end in the animation. More...
 
float totalDuration () const
 Get the duration of the animation. More...
 
virtual void update (MultiWidgets::Widget &w, const MultiWidgets::FrameInfo &frameInfo)
 Updates the animation state and applies the value to the attribute. More...
 
float value () const
 Get the current value of the animated parameter. More...
 
virtual ~AnimatorT ()
 Destructor.
 
- Protected Member Functions inherited from MultiWidgets::AnimatorT< float >
virtual void animate (MultiWidgets::Widget &w, float dt)
 Calculates the current parameter value. More...
 
void interpolate ()
 Performs the actual interpolation of key frames.
 
- Protected Attributes inherited from MultiWidgets::AnimatorT< float >
Valuable::AttributeFlagsT< Flagsm_flags
 Animation flags.
 
std::vector< Key< float > > m_keys
 Collection of key frames.
 
Valuable::AttributeString m_param
 Name of the parameter to animate.
 
float m_result
 Result of the animation.
 
float m_timeElapsed
 Elapsed time since the start of the animation. More...
 

Detailed Description

Animator for implementing fade-ins and fade-outs.

This animator is an utility class to animate the opacity parameter of widgets.

Member Function Documentation

static void MultiWidgets::FadeAnimator::fadeOutAndDelete ( MultiWidgets::Widget w,
float  duration,
float  predelay = 0.0f 
)
static

Apply a fade-out animation and delete the given widget.

Once the fade-out has been completed, the widget is deleted, by removing it from its parent. The input flags are set to zero immediately.

Parameters
wtarget widget
durationduration of the fade-out animation in seconds
predelaydelay in seconds before the fade-out is started
static void MultiWidgets::FadeAnimator::fadeOutAndHide ( MultiWidgets::Widget w,
float  duration,
float  predelay = 0.0f 
)
static

Apply a fade-out animation and hide the given widget.

Once the fade-out has been completed, the widget is hidden. The input flags are set to zero immediately.

Parameters
wtarget widget
durationduration of the fade-out animation in seconds
predelaydelay in seconds before the fade-out is started