Wt: Wt::WAnimation Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
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.h>`

## Public Types
typedef AnimationEffect | Effect
| Typedef for enum Wt::AnimationEffect.

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

## 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()

## 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 = TimingFunction::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
  setDuration()

## ◆ effects()

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

Returns animation effects.

See also
  setEffects()

## ◆ 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
  duration()

## ◆ 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 TimingFunction::Linear.

## ◆ timingFunction()

TimingFunction Wt::WAnimation::timingFunction | ( |  | ) | const

Returns the timing function.

See also
  setTimingFunction()