Wt  3.7.1
Public Types | Public Member Functions | List of all members
Wt::WAnimation Class Reference

A value class that defines a transition effect. More...

#include <Wt/WAnimation>

Public Types

enum  AnimationEffect {
  SlideInFromLeft = 0x1, SlideInFromRight = 0x2, SlideInFromBottom = 0x3, SlideInFromTop = 0x4,
  Pop = 0x5, Fade = 0x100
 An enumeration describing an animation effect. More...
enum  TimingFunction {
  Ease, Linear, EaseIn, EaseOut,
  EaseInOut, CubicBezier
 A timing function. More...

Public Member Functions

 WAnimation ()
 Default constructor. More...
 WAnimation (WFlags< AnimationEffect > effects, TimingFunction timing=Linear, int duration=250)
 Creates an animation. More...
void setEffects (WFlags< AnimationEffect > effects)
 Sets the animation effects. More...
WFlags< AnimationEffecteffects () const
 Returns animation effects. More...
bool operator== (const WAnimation &other) const
 Comparison operator. More...
bool operator!= (const WAnimation &other) const
 Comparison operator. More...
void setDuration (int msecs)
 Sets the duration. More...
int duration () const
 Returns the duration. More...
void setTimingFunction (TimingFunction function)
 Sets a timing function. More...
TimingFunction timingFunction () const
 Returns the timing function. More...
bool empty () const
 Returns whether the animation is empty. More...

Detailed Description

A value class that defines a transition effect.

This class defines an animation used as a transition to show or hide a widget.

The animation can be defined as a motion effect (e.g. sliding in or out), optionally combined with a fade effect. A timing function defines how the effects(s) are animated during the total duration of the animation.

See also
WWidget::animateShow(), WWidget::animateHide(), WWidget::setHidden()

Member Enumeration Documentation

◆ AnimationEffect

An enumeration describing an animation effect.

An animation effect can be the combination of a motion and an optional fade effect, e.g:

You can specify only one motion effect.

See also

Slides right to show, left to hide.


Slides left to show, right to hide.


Slides up to show, down to hide.


Slides down to show, up to hide.


Pops up to show, pops away to hide.


Fade effect.

◆ TimingFunction

A timing function.

The timing function defines how the animation effects are animated during the total duration of the animation.


Slow start and slow finish.


Linear throughout.


Slow start.


Slow finish.


Slow start and even slower finish.


(Currently unsupported)

Constructor & Destructor Documentation

◆ WAnimation() [1/2]

Wt::WAnimation::WAnimation ( )

Default constructor.

Creates an animation that actually represent no animation. (effects() == 0).

◆ WAnimation() [2/2]

Wt::WAnimation::WAnimation ( WFlags< AnimationEffect effects,
TimingFunction  timing = Linear,
int  duration = 250 

Creates an animation.

An animation is created with given effects, timing and duration.

Member Function Documentation

◆ duration()

int Wt::WAnimation::duration ( ) const

Returns the duration.

See also

◆ effects()

WFlags<AnimationEffect> Wt::WAnimation::effects ( ) const

Returns animation effects.

See also

◆ empty()

bool Wt::WAnimation::empty ( ) const

Returns whether the animation is empty.

An animation is empty (meaning the transition is instant), if the duration is 0, or if no effects are defined.

◆ operator!=()

bool Wt::WAnimation::operator!= ( const WAnimation other) const

Comparison operator.

Returns true if the transitions are different.

◆ operator==()

bool Wt::WAnimation::operator== ( const WAnimation other) const

Comparison operator.

Returns true if the transitions are exactly the same.

◆ setDuration()

void Wt::WAnimation::setDuration ( int  msecs)

Sets the duration.

The default animation duration is 250 ms.

See also

◆ setEffects()

void Wt::WAnimation::setEffects ( WFlags< AnimationEffect effects)

Sets the animation effects.

A motion effect (SlideInFromLeft, SlideInFromRight, SlideInFromBottom, SlideInFromTop or Pop) can be combined with a fade effect (Fade).

When effects are 0, the animation does not actually specify an animation, but instead an instant transition.

◆ setTimingFunction()

void Wt::WAnimation::setTimingFunction ( TimingFunction  function)

Sets a timing function.

The default timinig function is WAnimation::Linear.

◆ timingFunction()

TimingFunction Wt::WAnimation::timingFunction ( ) const

Returns the timing function.

See also

Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13