Magnum::Ui::NodeAnimation class new in Git master

Node animation properties.

Used to pass arguments to NodeAnimator::create(). See the NodeAnimator class documentation for more information and usage examples.

Constructors, destructors, conversion operators

NodeAnimation() defaulted explicit constexpr
Constructor.

Public functions

auto offsets() const -> Containers::Pair<Vector2, Vector2>
Source and target offsets.
auto fromOffsetX(Float sourceOffset) -> NodeAnimation& constexpr
Animate from given X offset.
auto fromOffsetY(Float sourceOffset) -> NodeAnimation& constexpr
Animate from given Y offset.
auto fromOffset(const Vector2& sourceOffset) -> NodeAnimation& constexpr
Animate from given offset.
auto toOffsetX(Float targetOffset) -> NodeAnimation& constexpr
Animate to given X offset.
auto toOffsetY(Float targetOffset) -> NodeAnimation& constexpr
Animate to given Y offset.
auto toOffset(const Vector2& targetOffset) -> NodeAnimation& constexpr
Animate to given offset.
auto sizes() const -> Containers::Pair<Vector2, Vector2>
Source and target sizes.
auto fromSizeX(Float sourceWidth) -> NodeAnimation& constexpr
Animate from given width.
auto fromSizeY(Float sourceHeight) -> NodeAnimation& constexpr
Animate from given height.
auto fromSize(const Vector2& sourceSize) -> NodeAnimation& constexpr
Animate from given size.
auto toSizeX(Float targetWidth) -> NodeAnimation& constexpr
Animate to given width.
auto toSizeY(Float targetHeight) -> NodeAnimation& constexpr
Animate to given height.
auto toSize(const Vector2& targetSize) -> NodeAnimation& constexpr
Animate to given size.
auto opacities() const -> Containers::Pair<Float, Float>
Source and target opacities.
auto fromOpacity(Float sourceOpacity) -> NodeAnimation& constexpr
Animate from given opacity.
auto toOpacity(Float targetOpacity) -> NodeAnimation& constexpr
Animate to given opacity.
auto flagsAdd() const -> Containers::Pair<NodeFlags, NodeFlags>
Node flags to add at animation begin and end.
auto addFlagsBegin(NodeFlags flags) -> NodeAnimation& constexpr
Add node flags when the animation begins.
auto addFlagsEnd(NodeFlags flags) -> NodeAnimation& constexpr
Add node flags when the animation ends.
auto flagsClear() const -> Containers::Pair<NodeFlags, NodeFlags>
Node flags to clear at animation begin and end.
auto clearFlagsBegin(NodeFlags flags) -> NodeAnimation& constexpr
Clear node flags when the animation begins.
auto clearFlagsEnd(NodeFlags flags) -> NodeAnimation& constexpr
Clear node flags when the animation ends.
auto hasRemoveNodeAfter() const -> bool constexpr
Whether the node is removed when the animation stops.
auto setRemoveNodeAfter(bool remove = true) -> NodeAnimation& constexpr
Remove a node when the animation stops.

Function documentation

Magnum::Ui::NodeAnimation::NodeAnimation() explicit defaulted constexpr

Constructor.

By default, nothing is animated. Call various offset, size, opacity and flag setters to specify what to animate.

Containers::Pair<Vector2, Vector2> Magnum::Ui::NodeAnimation::offsets() const

Source and target offsets.

Components that are NaN are taken from the AbstractUserInterface at the time the animation starts. If a component is a NaN in both the source and the target offset, it's not animated at all.

NodeAnimation& Magnum::Ui::NodeAnimation::fromOffsetX(Float sourceOffset) constexpr

Animate from given X offset.

If toOffsetX() isn't called as well, the animation will move the node from sourceOffset to the X offset the node has at the time the animation starts. If neither fromOffsetX() nor toOffsetX() is called, node X offset stays unchanged. Passing Constants::nan() as sourceOffset is equivalent to not calling this function at all.

The offset is always interpreted as relative to the node parent.

NodeAnimation& Magnum::Ui::NodeAnimation::fromOffsetY(Float sourceOffset) constexpr

Animate from given Y offset.

If toOffsetY() isn't called as well, the animation will move the node from sourceOffset to the Y offset the node has at the time the animation starts. If neither fromOffsetY() nor toOffsetY() is called, node Y offset stays unchanged. Passing Constants::nan() as sourceOffset is equivalent to not calling this function at all.

The offset is always interpreted as relative to the node parent.

NodeAnimation& Magnum::Ui::NodeAnimation::fromOffset(const Vector2& sourceOffset) constexpr

Animate from given offset.

Same as calling fromOffsetX() and fromOffsetY() with the X and Y component of sourceOffset. See their documentation for more information.

NodeAnimation& Magnum::Ui::NodeAnimation::toOffsetX(Float targetOffset) constexpr

Animate to given X offset.

If fromOffsetX() isn't called as well, the animation will move the node from the X offset the node has at the time the animation starts to targetOffset. If neither fromOffsetX() nor toOffsetX() is called, node X offset stays unchanged. Passing Constants::nan() as targetOffset is equivalent to not calling this function at all.

The offset is always interpreted as relative to the node parent.

NodeAnimation& Magnum::Ui::NodeAnimation::toOffsetY(Float targetOffset) constexpr

Animate to given Y offset.

If fromOffsetY() isn't called as well, the animation will move the node from the Y offset the node has at the time the animation starts to targetOffset. If neither fromOffsetY() nor toOffsetY() is called, node Y offset stays unchanged. Passing Constants::nan() as targetOffset is equivalent to not calling this function at all.

The offset is always interpreted as relative to the node parent.

NodeAnimation& Magnum::Ui::NodeAnimation::toOffset(const Vector2& targetOffset) constexpr

Animate to given offset.

Same as calling toOffsetX() and toOffsetY() with the X and Y component of targetOffset. See their documentation for more information.

Containers::Pair<Vector2, Vector2> Magnum::Ui::NodeAnimation::sizes() const

Source and target sizes.

Components that are NaN are taken from the AbstractUserInterface at the time the animation starts. If a component is a NaN in both the source and the target offset, it's not animated at all.

NodeAnimation& Magnum::Ui::NodeAnimation::fromSizeX(Float sourceWidth) constexpr

Animate from given width.

If toSizeX() isn't called as well, the animation will resize the node from sourceWidth to the width the node has at the time the animation starts. If neither fromSizeX() nor toSizeX() is called, node width stays unchanged. Passing Constants::nan() as sourceWidth is equivalent to not calling this function at all.

NodeAnimation& Magnum::Ui::NodeAnimation::fromSizeY(Float sourceHeight) constexpr

Animate from given height.

If toSizeY() isn't called as well, the animation will resize the node from sourceHeight to the height the node has at the time the animation starts. If neither fromSizeY() nor toSizeY() is called, node height stays unchanged. Passing Constants::nan() as sourceHeight is equivalent to not calling this function at all.

NodeAnimation& Magnum::Ui::NodeAnimation::fromSize(const Vector2& sourceSize) constexpr

Animate from given size.

Same as calling fromSizeX() and fromSizeY() with the X and Y component of sourceSize. See their documentation for more information.

NodeAnimation& Magnum::Ui::NodeAnimation::toSizeX(Float targetWidth) constexpr

Animate to given width.

If fromSizeX() isn't called as well, the animation will resize the node the width the node has at the time the animation starts to targetWidth. If neither fromSizeX() nor toSizeX() is called, node width stays unchanged. Passing Constants::nan() as targetWidth is equivalent to not calling this function at all.

NodeAnimation& Magnum::Ui::NodeAnimation::toSizeY(Float targetHeight) constexpr

Animate to given height.

If fromSizeY() isn't called as well, the animation will resize the node the height the node has at the time the animation starts to targetHeight. If neither fromSizeY() nor toSizeY() is called, node height stays unchanged. Passing Constants::nan() as targetHeight is equivalent to not calling this function at all.

NodeAnimation& Magnum::Ui::NodeAnimation::toSize(const Vector2& targetSize) constexpr

Animate to given size.

Same as calling toSizeX() and toSizeY() with the X and Y component of targetSize. See their documentation for more information.

Containers::Pair<Float, Float> Magnum::Ui::NodeAnimation::opacities() const

Source and target opacities.

Values that are NaN are taken from the AbstractUserInterface at the time the animation starts. If both the source and the target opacity is a NaN, it's not animated at all.

NodeAnimation& Magnum::Ui::NodeAnimation::fromOpacity(Float sourceOpacity) constexpr

Animate from given opacity.

If toOpacity() isn't called as well, the animation will move the node from sourceOpacity to the opacity the node has at the time the animation starts. If neither fromOpacity() nor toOpacity() is called, node opacity stays unchanged.

NodeAnimation& Magnum::Ui::NodeAnimation::toOpacity(Float targetOpacity) constexpr

Animate to given opacity.

If fromOpacity() isn't called as well, the animation will move the node from the opacity the node has at the time the animation starts to targetOpacity. If neither fromOpacity() nor toOpacity() is called, node opacity stays unchanged.

NodeAnimation& Magnum::Ui::NodeAnimation::addFlagsBegin(NodeFlags flags) constexpr

Add node flags when the animation begins.

Adds flags to the set of flags the node has at the beginning of the animation. If clearFlagsBegin() is called as well, the clear happens before the add. If none of addFlagsBegin(), clearFlagsBegin(), addFlagsEnd(), clearFlagsEnd() is called, node flags stay unchanged. If the animation has AnimationFlag::Reverse set, the flags are cleared at animation stop instead of being added at start. Presence of AnimationFlag::ReverseEveryOther has no effect on this behavior. If the animation has multiple repeats, the flags are updated only for the very first / very last repeat.

Note that, unlike with AbstractUserInterface::addNodeFlags(), calling this function multiple times replaces the set of flags to add, doesn't merge into it.

NodeAnimation& Magnum::Ui::NodeAnimation::addFlagsEnd(NodeFlags flags) constexpr

Add node flags when the animation ends.

Adds flags to the set of flags the node has at the end of the animation. If clearFlagsEnd() is called as well, the clear happens before adding flags. If none of addFlagsBegin(), clearFlagsBegin(), addFlagsEnd(), clearFlagsEnd() is called, node flags stay unchanged. If the animation has AnimationFlag::Reverse set, the flags are cleared at animation start instead of being added at stop. Presence of AnimationFlag::ReverseEveryOther has no effect on this behavior. If the animation has multiple repeats, the flags are updated only for the very last / very first repeat.

Note that, unlike with AbstractUserInterface::addNodeFlags(), calling this function multiple times replaces the set of flags to add, doesn't merge into it.

NodeAnimation& Magnum::Ui::NodeAnimation::clearFlagsBegin(NodeFlags flags) constexpr

Clear node flags when the animation begins.

Clears flags from the set of flags the node has at the beginning of the animation. If addFlagsBegin() is called as well, the clear happens before the add. If none of addFlagsBegin(), clearFlagsBegin(), addFlagsEnd(), clearFlagsEnd() is called, node flags stay unchanged. If the animation has AnimationFlag::Reverse set, the flags are added at animation stop instead of being cleared at start. Presence of AnimationFlag::ReverseEveryOther has no effect on this behavior. If the animation has multiple repeats, the flags are updated only for the very first / very last repeat.

Note that, unlike with AbstractUserInterface::clearNodeFlags(), calling this function multiple times replaces the set of flags to clear, doesn't merge into it.

NodeAnimation& Magnum::Ui::NodeAnimation::clearFlagsEnd(NodeFlags flags) constexpr

Clear node flags when the animation ends.

Clears flags from the set of flags the node has at the end of the animation. If addFlagsEnd() is called as well, the clear happens before the add. If none of addFlagsBegin(), clearFlagsBegin(), addFlagsEnd(), clearFlagsEnd() is called, node flags stay unchanged. If the animation has AnimationFlag::Reverse set, the flags are added at animation start instead of being cleared at stop. Presence of AnimationFlag::ReverseEveryOther has no effect on this behavior. If the animation has multiple repeats, the flags are updated only for the very last / very first repeat.

Note that, unlike with AbstractUserInterface::clearNodeFlags(), calling this function multiple times replaces the set of flags to clear, doesn't merge into it.

NodeAnimation& Magnum::Ui::NodeAnimation::setRemoveNodeAfter(bool remove = true) constexpr

Remove a node when the animation stops.

If remove is true and the animation attachment isn't NodeHandle::Null, the node gets automatically removed once the animation stops. If false or if this function isn't called at all, the node doesn't get removed. AnimationFlag::Reverse and AnimationFlag::ReverseEveryOther don't affect the behavior in any way, the removal is done once the animation stops regardless of these being present.

Note that, if removal is enabled, since the animation is attached to the node, it gets subsequently removed as well, regardless of whether AnimationFlag::KeepOncePlayed is specified in NodeAnimator::create().