class new in Git master
#include <Magnum/Ui/AbstractAnimator.h>
AbstractAnimator Base for animators.
Derived classes
- class AbstractDataAnimator new in Git master
- Base for data animators.
- class AbstractGenericAnimator new in Git master
- Base for generic animators.
- class AbstractNodeAnimator new in Git master
- Base for node animators.
- class AbstractStyleAnimator new in Git master
- Base for style animators.
Constructors, destructors, conversion operators
- AbstractAnimator(AnimatorHandle handle) explicit
- Constructor.
- AbstractAnimator(const AbstractAnimator&) deleted
- Copying is not allowed.
- AbstractAnimator(AbstractAnimator&&) noexcept
- Move constructor.
Public functions
- auto operator=(const AbstractAnimator&) -> AbstractAnimator& deleted
- Copying is not allowed.
- auto operator=(AbstractAnimator&&) -> AbstractAnimator& noexcept
- Move assignment.
- auto handle() const -> AnimatorHandle
- Animator handle.
- auto features() const -> AnimatorFeatures
- Features exposed by an animator.
- auto layer() const -> LayerHandle
- Layer handle a data animator is associated with.
- auto state() const -> AnimatorStates
- Animator state.
- auto time() const -> Nanoseconds
- Animator time.
-
auto capacity() const -> std::
size_t - Current capacity of the data storage.
-
auto usedCount() const -> std::
size_t - Count of used items in the data storage.
- auto isHandleValid(AnimatorDataHandle handle) const -> bool
- Whether an animation handle is valid.
- auto isHandleValid(AnimationHandle handle) const -> bool
- Whether an animation handle is valid.
- auto duration(AnimationHandle handle) const -> Nanoseconds
- Duration of one animation play.
- auto duration(AnimatorDataHandle handle) const -> Nanoseconds
- Duration of one animation play assuming it belongs to this animator.
- auto repeatCount(AnimationHandle handle) const -> UnsignedInt
- Animation repeat count.
- auto repeatCount(AnimatorDataHandle handle) const -> UnsignedInt
- Animation repeat count assuming it belongs to this animator.
- void setRepeatCount(AnimationHandle handle, UnsignedInt count)
- Set animation repeat count.
- void setRepeatCount(AnimatorDataHandle handle, UnsignedInt count)
- Set animation repeat count assuming it belongs to this animator.
- auto flags(AnimationHandle handle) const -> AnimationFlags
- Animation flags.
- auto flags(AnimatorDataHandle handle) const -> AnimationFlags
- Animation flags assuming it belongs to this animator.
- void setFlags(AnimationHandle handle, AnimationFlags flags)
- Set animation flags.
- void setFlags(AnimatorDataHandle handle, AnimationFlags flags)
- Set animation flags assuming it belongs to this animator.
- void addFlags(AnimationHandle handle, AnimationFlags flags)
- Add animation flags.
- void addFlags(AnimatorDataHandle handle, AnimationFlags flags)
- Add animation flags assuming it belongs to this animator.
- void clearFlags(AnimationHandle handle, AnimationFlags flags)
- Clear animation flags.
- void clearFlags(AnimatorDataHandle handle, AnimationFlags flags)
- Clear animation flags assuming it belongs to this animator.
- auto played(AnimationHandle handle) const -> Nanoseconds
- Time at which an animation is played.
- auto played(AnimatorDataHandle handle) const -> Nanoseconds
- Time at which an animation is played assuming it belongs to this animator.
- auto paused(AnimationHandle handle) const -> Nanoseconds
- Animation paused time.
- auto paused(AnimatorDataHandle handle) const -> Nanoseconds
- Animation paused time assuming it belongs to this animator.
- auto stopped(AnimationHandle handle) const -> Nanoseconds
- Animation stopped time.
- auto stopped(AnimatorDataHandle handle) const -> Nanoseconds
- Animation stopped time assuming it belongs to this animator.
- void attach(AnimationHandle animation, NodeHandle node)
- Attach an animation to a node.
- void attach(AnimatorDataHandle animation, NodeHandle node)
- Attach an animation to a node assuming it belongs to this animator.
- auto node(AnimationHandle handle) const -> NodeHandle
- Node handle an animation is attached to.
- auto node(AnimatorDataHandle handle) const -> NodeHandle
- Node handle an animation is attached to assuming the animation belongs to this animator.
-
auto nodes() const -> Containers::
StridedArrayView1D<const NodeHandle> - Node attachments for all animations.
- void attach(AnimationHandle animation, DataHandle data)
- Attach an animation to a data.
- void attach(AnimatorDataHandle animation, DataHandle data)
- Attach an animation to a data assuming the animation belongs to this animator.
- void attach(AnimationHandle animation, LayerDataHandle data)
- Attach an animation to a data assuming the data belongs to a layer registered with this animator.
- void attach(AnimatorDataHandle animation, LayerDataHandle data)
- Attach an animation to a data assuming the animation belongs to this animator and the data belongs to a layer registered with this animator.
- auto data(AnimationHandle handle) const -> DataHandle
- Data handle an animation is attached to.
- auto data(AnimatorDataHandle handle) const -> DataHandle
- Data handle an animation is attached to assuming the animation belongs to this animator.
-
auto layerData() const -> Containers::
StridedArrayView1D<const LayerDataHandle> - Layer data attachments for all animations.
- auto state(AnimationHandle handle) const -> AnimationState
- Animation state.
- auto state(AnimatorDataHandle handle) const -> AnimationState
- Animation state assuming it belongs to this animator.
- auto factor(AnimationHandle handle) const -> Float
- Animation interpolation factor.
- auto factor(AnimatorDataHandle handle) const -> Float
- Animation interpolation factor assuming it belongs to this animator.
- void play(AnimationHandle handle, Nanoseconds time)
- Play an animation or resume a paused one.
- void play(AnimatorDataHandle handle, Nanoseconds time)
- Play an animation or resume a paused one assuming it belongs to this animator.
- void pause(AnimationHandle handle, Nanoseconds time)
- Pause an animation.
- void pause(AnimatorDataHandle handle, Nanoseconds time)
- Pause an animation assuming it belongs to this animator.
- void stop(AnimationHandle handle, Nanoseconds time)
- Stop an animation.
- void stop(AnimatorDataHandle handle, Nanoseconds time)
- Stop an animation assuming it belongs to this animator.
-
auto generations() const -> Containers::
StridedArrayView1D<const UnsignedShort> - Generation counters for all data.
-
void clean(Containers::
BitArrayView animationIdsToRemove) - Clean no longer valid animations.
-
void cleanNodes(const Containers::
StridedArrayView1D<const UnsignedShort>& nodeHandleGenerations) - Clean animations attached to no longer valid nodes.
-
void cleanData(const Containers::
StridedArrayView1D<const UnsignedShort>& dataHandleGenerations) - Clean animations attached to no longer valid data.
-
auto update(Nanoseconds time,
Containers::
MutableBitArrayView active, const Containers:: StridedArrayView1D<Float>& factors, Containers:: MutableBitArrayView remove) -> Containers:: Pair<bool, bool> - Update the internal state and calculate factors for animation advance.
Protected functions
- auto create(Nanoseconds played, Nanoseconds duration, UnsignedInt repeatCount = 1, AnimationFlags flags = {}) -> AnimationHandle
- Create an animation.
- auto create(Nanoseconds played, Nanoseconds duration, AnimationFlags flags) -> AnimationHandle
- Create an animation.
- auto create(Nanoseconds played, Nanoseconds duration, NodeHandle node, UnsignedInt repeatCount = 1, AnimationFlags flags = {}) -> AnimationHandle
- Create an animation attached to a node.
- auto create(Nanoseconds played, Nanoseconds duration, NodeHandle node, AnimationFlags flags) -> AnimationHandle
- Create an animation attached to a node.
- auto create(Nanoseconds played, Nanoseconds duration, DataHandle data, UnsignedInt repeatCount = 1, AnimationFlags flags = {}) -> AnimationHandle
- Create an animation attached to a data.
- auto create(Nanoseconds played, Nanoseconds duration, DataHandle data, AnimationFlags flags) -> AnimationHandle
- Create an animation attached to a data.
- auto create(Nanoseconds played, Nanoseconds duration, LayerDataHandle data, UnsignedInt repeatCount = 1, AnimationFlags flags = {}) -> AnimationHandle
- Create an animation attached to a data assuming the data belongs to the layer the animator is registered with.
- auto create(Nanoseconds played, Nanoseconds duration, LayerDataHandle data, AnimationFlags flags) -> AnimationHandle
- Create an animation attached to a data assuming the data belongs to the layer the animator is registered with.
- void remove(AnimationHandle handle)
- Remove an animation.
- void remove(AnimatorDataHandle handle)
- Remove an animation assuming it belongs to this animator.
Private functions
- auto doFeatures() const -> AnimatorFeatures pure virtual
- Implementation for features()
-
void doClean(Containers::
BitArrayView animationIdsToRemove) virtual - Clean no longer valid animations.
Function documentation
Magnum:: Ui:: AbstractAnimator:: AbstractAnimator(AnimatorHandle handle) explicit
Constructor.
Parameters | |
---|---|
handle | Handle returned by AbstractUserInterface:: |
Magnum:: Ui:: AbstractAnimator:: AbstractAnimator(AbstractAnimator&&) noexcept
Move constructor.
Performs a destructive move, i.e. the original object isn't usable afterwards anymore.
AnimatorHandle Magnum:: Ui:: AbstractAnimator:: handle() const
Animator handle.
Returns the handle passed to the constructor.
LayerHandle Magnum:: Ui:: AbstractAnimator:: layer() const
Layer handle a data animator is associated with.
Expects that the animator supports AnimatorFeature::
AnimatorStates Magnum:: Ui:: AbstractAnimator:: state() const
Animator state.
See the AnimatorState enum for more information. By default no flags are set.
Nanoseconds Magnum:: Ui:: AbstractAnimator:: time() const
Animator time.
Time value last passed to update(). Initial value is 0_nsec
.
std:: size_t Magnum:: Ui:: AbstractAnimator:: capacity() const
Current capacity of the data storage.
Can be at most 1048576. If create() is called and there's no free slots left, the internal storage gets grown.
std:: size_t Magnum:: Ui:: AbstractAnimator:: usedCount() const
Count of used items in the data storage.
Always at most capacity(). Expired handles are counted among used as well. The operation is done with a complexity where is capacity().
bool Magnum:: Ui:: AbstractAnimator:: isHandleValid(AnimatorDataHandle handle) const
Whether an animation handle is valid.
A handle is valid if it has been returned from create() before and remove() wasn't called on it yet. For AnimatorDataHandle::false
.
bool Magnum:: Ui:: AbstractAnimator:: isHandleValid(AnimationHandle handle) const
Whether an animation handle is valid.
A shorthand for extracting an AnimatorHandle from handle
using animationHandleAnimator(), comparing it to handle() and if it's the same, calling isHandleValid(AnimatorDataHandle) const with an AnimatorDataHandle extracted from handle
using animationHandleData(). See these functions for more information. For AnimationHandle::false
.
Nanoseconds Magnum:: Ui:: AbstractAnimator:: duration(AnimationHandle handle) const
Duration of one animation play.
Expects that handle
is valid. The duration is specified with create() and is always positive. The duration, together with played(AnimationHandle) const, paused(AnimationHandle) const, stopped(AnimationHandle) const, repeatCount(AnimationHandle) const and time() is used to decide on a particular AnimationState for given animation. See also duration(AnimatorDataHandle) const which is a simpler operation if the animation is already known to belong to this animator.
Nanoseconds Magnum:: Ui:: AbstractAnimator:: duration(AnimatorDataHandle handle) const
Duration of one animation play assuming it belongs to this animator.
Like duration(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
UnsignedInt Magnum:: Ui:: AbstractAnimator:: repeatCount(AnimationHandle handle) const
Animation repeat count.
Expects that handle
is valid. The repeat count is specified with create() and can be subsequently modified with setRepeatCount(). Value of 0
means the animation is repeated indefinitely. The repeat count, together with duration(AnimationHandle) const, played(AnimationHandle) const, paused(AnimationHandle) const, stopped(AnimationHandle) const and time() is used to decide on a particular AnimationState for given animation. See also repeatCount(AnimatorDataHandle) const which is a simpler operation if the animation is already known to belong to this animator.
UnsignedInt Magnum:: Ui:: AbstractAnimator:: repeatCount(AnimatorDataHandle handle) const
Animation repeat count assuming it belongs to this animator.
Like repeatCount(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: setRepeatCount(AnimationHandle handle,
UnsignedInt count)
Set animation repeat count.
Expects that handle
is valid. Use 0
for an indefinitely repeating animation. The repeat count, together with duration(AnimationHandle) const, played(AnimationHandle) const, paused(AnimationHandle) const, stopped(AnimationHandle) const and time() is subsequently used to decide on a particular AnimationState for given animation. See also setRepeatCount(AnimatorDataHandle, UnsignedInt) which is a simpler operation if the animation is already known to belong to this animator.
Compared to create() or play(), a change in repeat count doesn't change the animation to AnimationState::
void Magnum:: Ui:: AbstractAnimator:: setRepeatCount(AnimatorDataHandle handle,
UnsignedInt count)
Set animation repeat count assuming it belongs to this animator.
Like setRepeatCount(AnimationHandle, UnsignedInt) but without checking that handle
indeed belongs to this animator. See its documentation for more information.
AnimationFlags Magnum:: Ui:: AbstractAnimator:: flags(AnimationHandle handle) const
Animation flags.
Expects that handle
is valid. The flags are specified with create() and can be subsequently modified with setFlags(), addFlags() or clearFlags(). See also flags(AnimatorDataHandle) const which is a simpler operation if the animation is already known to belong to this animator.
AnimationFlags Magnum:: Ui:: AbstractAnimator:: flags(AnimatorDataHandle handle) const
Animation flags assuming it belongs to this animator.
Like flags(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: setFlags(AnimationHandle handle,
AnimationFlags flags)
Set animation flags.
Expects that handle
is valid. See also setFlags(AnimatorDataHandle, AnimationFlags) which is a simpler operation if the animation is already known to belong to this animator.
Compared to create(), play() or pause(), a change in flags never causes the animation to become AnimationState::
void Magnum:: Ui:: AbstractAnimator:: setFlags(AnimatorDataHandle handle,
AnimationFlags flags)
Set animation flags assuming it belongs to this animator.
Like setFlags(AnimationHandle, AnimationFlags) but without checking that handle
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: addFlags(AnimationHandle handle,
AnimationFlags flags)
Add animation flags.
Calls setFlags(AnimationHandle, AnimationFlags) with the existing flags ORed with flags
. Useful for preserving previously set flags. See also addFlags(AnimatorDataHandle, AnimationFlags) which is a simpler operation if the animation is already known to belong to this animator.
void Magnum:: Ui:: AbstractAnimator:: addFlags(AnimatorDataHandle handle,
AnimationFlags flags)
Add animation flags assuming it belongs to this animator.
Like addFlags(AnimationHandle, AnimationFlags) but without checking that handle
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: clearFlags(AnimationHandle handle,
AnimationFlags flags)
Clear animation flags.
Calls setFlags(AnimationHandle, AnimationFlags) with the existing flags ANDed with the inverse of flags
. Useful for removing a subset of previously set flags. See also clearFlags(AnimatorDataHandle, AnimationFlags) which is a simpler operation if the animation is already known to belong to this animator.
void Magnum:: Ui:: AbstractAnimator:: clearFlags(AnimatorDataHandle handle,
AnimationFlags flags)
Clear animation flags assuming it belongs to this animator.
Like clearFlags(AnimationHandle, AnimationFlags) but without checking that handle
indeed belongs to this animator. See its documentation for more information.
Nanoseconds Magnum:: Ui:: AbstractAnimator:: played(AnimationHandle handle) const
Time at which an animation is played.
Expects that handle
is valid. The time an animation is played at is specified with create() and is subsequently affected by calling play() or stop(). The specified time, together with duration(AnimationHandle) const, repeatCount(AnimationHandle) const, paused(AnimationHandle) const, stopped(AnimationHandle) const and time() is used to decide on a particular AnimationState for given animation. See also played(AnimatorDataHandle) const which is a simpler operation if the animation is already known to belong to this animator.
Nanoseconds Magnum:: Ui:: AbstractAnimator:: played(AnimatorDataHandle handle) const
Time at which an animation is played assuming it belongs to this animator.
Like played(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
Nanoseconds Magnum:: Ui:: AbstractAnimator:: paused(AnimationHandle handle) const
Animation paused time.
Expects that handle
is valid. The paused time is initially Nanoseconds::
Nanoseconds Magnum:: Ui:: AbstractAnimator:: paused(AnimatorDataHandle handle) const
Animation paused time assuming it belongs to this animator.
Like paused(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
Nanoseconds Magnum:: Ui:: AbstractAnimator:: stopped(AnimationHandle handle) const
Animation stopped time.
Expects that handle
is valid. The stopped time is initially Nanoseconds::
Nanoseconds Magnum:: Ui:: AbstractAnimator:: stopped(AnimatorDataHandle handle) const
Animation stopped time assuming it belongs to this animator.
Like stopped(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: attach(AnimationHandle animation,
NodeHandle node)
Attach an animation to a node.
Makes the animation
handle tied to a particular node
, meaning it'll get scheduled for removal during the next cleanNodes() call when AbstractUserInterface::node
or any parent node.
Expects that animation
is valid and that the animator supports AnimatorFeature::node
can be anything including NodeHandle::animation
is already attached to some node, this will overwrite the previous attachment — i.e., it's not possible to have the same animation attached to multiple nodes. The inverse, attaching multiple different animation handles to a single node, is supported however.
Unlike with e.g. AbstractLayer::
void Magnum:: Ui:: AbstractAnimator:: attach(AnimatorDataHandle animation,
NodeHandle node)
Attach an animation to a node assuming it belongs to this animator.
Like attach(AnimationHandle, NodeHandle) but without checking that animation
indeed belongs to this animator. See its documentation for more information.
NodeHandle Magnum:: Ui:: AbstractAnimator:: node(AnimationHandle handle) const
Node handle an animation is attached to.
Expects that handle
is valid and that the animator supports AnimatorFeature::
The returned handle may be invalid if either the animation got attached to an invalid node in the first place or the node or any of its parents were removed and AbstractUserInterface::
NodeHandle Magnum:: Ui:: AbstractAnimator:: node(AnimatorDataHandle handle) const
Node handle an animation is attached to assuming the animation belongs to this animator.
Like node(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
Containers:: StridedArrayView1D<const NodeHandle> Magnum:: Ui:: AbstractAnimator:: nodes() const
Node attachments for all animations.
Expects that the animator supports AnimatorFeature::
void Magnum:: Ui:: AbstractAnimator:: attach(AnimationHandle animation,
DataHandle data)
Attach an animation to a data.
Makes the animation
handle tied to a particular data
, meaning it'll get scheduled for removal during the next cleanData() call when AbstractLayer::data
or when it gets removed as a consequence of a node removal.
Expects that animation
is valid and that the animator supports AnimatorFeature::data
is expected to be either DataHandle::animation
is already attached to some data, this will overwrite the previous attachment — i.e., it's not possible to have the same animation attached to multiple data. The inverse, attaching multiple different animation handles to a single data, is supported however.
Unlike with e.g. AbstractLayer::
void Magnum:: Ui:: AbstractAnimator:: attach(AnimatorDataHandle animation,
DataHandle data)
Attach an animation to a data assuming the animation belongs to this animator.
Like attach(AnimationHandle, DataHandle) but without checking that animation
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: attach(AnimationHandle animation,
LayerDataHandle data)
Attach an animation to a data assuming the data belongs to a layer registered with this animator.
Like attach(AnimationHandle, DataHandle) but without checking that data
is indeed coming from layer() const. See its documentation for more information. Calling this function with LayerDataHandle::
void Magnum:: Ui:: AbstractAnimator:: attach(AnimatorDataHandle animation,
LayerDataHandle data)
Attach an animation to a data assuming the animation belongs to this animator and the data belongs to a layer registered with this animator.
Like attach(AnimationHandle, DataHandle) but without checking that animation
indeed belongs to this animator and that that data
is indeed coming from layer() const. See its documentation for more information. Calling this function with LayerDataHandle::
DataHandle Magnum:: Ui:: AbstractAnimator:: data(AnimationHandle handle) const
Data handle an animation is attached to.
Expects that handle
is valid and that the animator supports AnimatorFeature::
The returned handle may be invalid if either the animation got attached to an invalid data in the first place or the data was removed and AbstractUserInterface::
DataHandle Magnum:: Ui:: AbstractAnimator:: data(AnimatorDataHandle handle) const
Data handle an animation is attached to assuming the animation belongs to this animator.
Like data(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
Containers:: StridedArrayView1D<const LayerDataHandle> Magnum:: Ui:: AbstractAnimator:: layerData() const
Layer data attachments for all animations.
Expects that the animator supports AnimatorFeature::
AnimationState Magnum:: Ui:: AbstractAnimator:: state(AnimationHandle handle) const
Animation state.
Expects that handle
is valid. Calculated based on the value of time() recorded in last update(), duration(AnimationHandle) const, repeatCount(AnimationHandle) const, played(AnimationHandle) const, paused(AnimationHandle) const and stopped(AnimationHandle) const for a particular animation. See also state(AnimatorDataHandle) const which is a simpler operation if the animation is already known to belong to this animator.
AnimationState Magnum:: Ui:: AbstractAnimator:: state(AnimatorDataHandle handle) const
Animation state assuming it belongs to this animator.
Like state(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
Float Magnum:: Ui:: AbstractAnimator:: factor(AnimationHandle handle) const
Animation interpolation factor.
Expects that handle
is valid. Calculated based on the value of time() recorded in last update(), duration(AnimationHandle) const, repeatCount(AnimationHandle) const, played(AnimationHandle) const, paused(AnimationHandle) const and stopped(AnimationHandle) const for a particular animation. The returned value is always in the range and matches what would be returned from update() for given animation at time(). For AnimationState::0.0f
, for AnimationState::1.0f
.
Float Magnum:: Ui:: AbstractAnimator:: factor(AnimatorDataHandle handle) const
Animation interpolation factor assuming it belongs to this animator.
Like factor(AnimationHandle) const but without checking that handle
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: play(AnimationHandle handle,
Nanoseconds time)
Play an animation or resume a paused one.
Expects that handle
is valid. The function effectively just updates the value of played(AnimationHandle) const and sets both paused(AnimationHandle) const and stopped(AnimationHandle) const to Nanoseconds::
If calling this function resulted in the animation being AnimationState::
void Magnum:: Ui:: AbstractAnimator:: play(AnimatorDataHandle handle,
Nanoseconds time)
Play an animation or resume a paused one assuming it belongs to this animator.
Like play(AnimationHandle, Nanoseconds) but without checking that handle
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: pause(AnimationHandle handle,
Nanoseconds time)
Pause an animation.
Expects that handle
is valid. The function effectively just updates the value of paused(AnimationHandle) const; the actual AnimationState is then decided based on the paused time together with duration(AnimationHandle) const, repeatCount(AnimationHandle) const, played(AnimationHandle) const, stopped(AnimationHandle) const and time().
If calling this function resulted in the animation being AnimationState::
void Magnum:: Ui:: AbstractAnimator:: pause(AnimatorDataHandle handle,
Nanoseconds time)
Pause an animation assuming it belongs to this animator.
Like pause(AnimationHandle, Nanoseconds) but without checking that handle
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: stop(AnimationHandle handle,
Nanoseconds time)
Stop an animation.
Expects that handle
is valid. The function effectively just updates the value of stopped(AnimationHandle) const; the actual AnimationState is then decided based on the stopped time together with duration(AnimationHandle) const, repeatCount(AnimationHandle) const, played(AnimationHandle) const, paused(AnimationHandle) const and time().
Compared to create(), play() or pause(), a change in stopped time never causes the animation to become AnimationState::
void Magnum:: Ui:: AbstractAnimator:: stop(AnimatorDataHandle handle,
Nanoseconds time)
Stop an animation assuming it belongs to this animator.
Like stop(AnimationHandle, Nanoseconds) but without checking that handle
indeed belongs to this animator. See its documentation for more information.
Containers:: StridedArrayView1D<const UnsignedShort> Magnum:: Ui:: AbstractAnimator:: generations() const
Generation counters for all data.
Meant to be used by code that only gets data IDs or masks but needs the full AnimationHandle / AnimatorDataHandle. Size of the returned view is the same as capacity().
void Magnum:: Ui:: AbstractAnimator:: clean(Containers:: BitArrayView animationIdsToRemove)
Clean no longer valid animations.
Used internally from subclass implementations such as AbstractGenericAnimator::animationIdsToRemove
view has the same size as capacity().
Animations which have a corresponding bit set in animationIdsToRemove
are removed. Delegates to doClean(), see its documentation for more information about the arguments.
void Magnum:: Ui:: AbstractAnimator:: cleanNodes(const Containers:: StridedArrayView1D<const UnsignedShort>& nodeHandleGenerations)
Clean animations attached to no longer valid nodes.
Used internally from AbstractUserInterface::nodeHandleGenerations
contains handle generation counters for all nodes, where the index is implicitly the handle ID. They're used to decide about node attachment validity, animations with invalid node attachments are then removed. Delegates to doClean(), see its documentation for more information about the arguments.
void Magnum:: Ui:: AbstractAnimator:: cleanData(const Containers:: StridedArrayView1D<const UnsignedShort>& dataHandleGenerations)
Clean animations attached to no longer valid data.
Used internally from AbstractUserInterface::dataHandleGenerations
contains handle generation counters for all data in layer matching layer() const, where the index is implicitly the handle ID. They're used to decide about data attachment validity, animations with invalid data attachments are then removed. Delegates to clean() and subsequently doClean(), see their documentation for more information.
Containers:: Pair<bool, bool> Magnum:: Ui:: AbstractAnimator:: update(Nanoseconds time,
Containers:: MutableBitArrayView active,
const Containers:: StridedArrayView1D<Float>& factors,
Containers:: MutableBitArrayView remove)
Update the internal state and calculate factors for animation advance.
Parameters | |
---|---|
time in | Time to which to calculate the factors |
active out | Where to put a mask of active animations |
factors out | Where to put animation interpolation factors |
remove out | Where to put a mask of animations to remove |
Returns | Whether any bits are set in active and in remove |
Used by AbstractUserInterface::time
is greater or equal to time() and size of active
, factors
and remove
is the same as capacity().
The active
view gets filled with a mask of animations that are AnimationState::time
or which changed to AnimationState::time
compared to time(), factors
get filled with interpolation factors for active animations and remove
gets filled with a mask of animations that are AnimationState::time
and don't have AnimationFlag::
If the first return value is true
, the active
, factors
and remove
views are meant to be passed to subclass implementations such as AbstractGenericAnimator::true
, the remove
view is then meant to be passed to clean().
Calling this function updates time() and sets AnimatorState::time
. However note that behavior of this function is independent of state() — it performs the update and fills the output views regardless of what flags are set.
AnimationHandle Magnum:: Ui:: AbstractAnimator:: create(Nanoseconds played,
Nanoseconds duration,
UnsignedInt repeatCount = 1,
AnimationFlags flags = {}) protected
Create an animation.
Parameters | |
---|---|
played | Time at which the animation is played. Use Nanoseconds:: |
duration | Duration of a single play of the animation |
repeatCount | Repeat count. Use 0 for an indefinitely repeating animation. |
flags | Flags |
Returns | New animation handle |
Allocates a new handle in a free slot in the internal storage or grows the storage if there's no free slots left. Expects that there's at most 1048576 animations. The returned handle can be removed again with remove().
The duration
is expected to be a positive value. The value of played
, duration
and repeatCount
together with time() is then used to decide on a particular AnimationState for given animation; if it results in AnimationState::
If the animator advertises AnimatorFeature::
AnimationHandle Magnum:: Ui:: AbstractAnimator:: create(Nanoseconds played,
Nanoseconds duration,
AnimationFlags flags) protected
Create an animation.
Same as calling create(Nanoseconds, Nanoseconds, UnsignedInt, AnimationFlags) with repeatCount
set to 1
.
AnimationHandle Magnum:: Ui:: AbstractAnimator:: create(Nanoseconds played,
Nanoseconds duration,
NodeHandle node,
UnsignedInt repeatCount = 1,
AnimationFlags flags = {}) protected
Create an animation attached to a node.
Parameters | |
---|---|
played | Time at which the animation is played. Use Nanoseconds:: |
duration | Duration of a single play of the animation |
node | Node the animation is attached to. Use NodeHandle:: |
repeatCount | Repeat count. Use 0 for an indefinitely repeating animation. |
flags | Flags |
Returns | New animation handle |
Expects that the animator supports AnimatorFeature::node
is not NodeHandle::
AnimationHandle Magnum:: Ui:: AbstractAnimator:: create(Nanoseconds played,
Nanoseconds duration,
NodeHandle node,
AnimationFlags flags) protected
Create an animation attached to a node.
Same as calling create(Nanoseconds, Nanoseconds, NodeHandle, UnsignedInt, AnimationFlags) with repeatCount
set to 1
.
AnimationHandle Magnum:: Ui:: AbstractAnimator:: create(Nanoseconds played,
Nanoseconds duration,
DataHandle data,
UnsignedInt repeatCount = 1,
AnimationFlags flags = {}) protected
Create an animation attached to a data.
Parameters | |
---|---|
played | Time at which the animation is played. Use Nanoseconds:: |
duration | Duration of a single play of the animation |
data | Data the animation is attached to. Use DataHandle:: |
repeatCount | Repeat count. Use 0 for an indefinitely repeating animation. |
flags | Flags |
Returns | New animation handle |
Expects that the animator supports AnimatorFeature::data
is either DataHandle::data
is not DataHandle::
AnimationHandle Magnum:: Ui:: AbstractAnimator:: create(Nanoseconds played,
Nanoseconds duration,
DataHandle data,
AnimationFlags flags) protected
Create an animation attached to a data.
Same as calling create(Nanoseconds, Nanoseconds, DataHandle, UnsignedInt, AnimationFlags) with repeatCount
set to 1
.
AnimationHandle Magnum:: Ui:: AbstractAnimator:: create(Nanoseconds played,
Nanoseconds duration,
LayerDataHandle data,
UnsignedInt repeatCount = 1,
AnimationFlags flags = {}) protected
Create an animation attached to a data assuming the data belongs to the layer the animator is registered with.
Compared to create(Nanoseconds, Nanoseconds, DataHandle, UnsignedInt, AnimationFlags) also requires that layer() const isn't LayerHandle::data
is coming from a layer with a handle equal to layer() const. Calling this function with LayerDataHandle::
AnimationHandle Magnum:: Ui:: AbstractAnimator:: create(Nanoseconds played,
Nanoseconds duration,
LayerDataHandle data,
AnimationFlags flags) protected
Create an animation attached to a data assuming the data belongs to the layer the animator is registered with.
Same as calling create(Nanoseconds, Nanoseconds, LayerDataHandle, UnsignedInt, AnimationFlags) with repeatCount
set to 1
.
void Magnum:: Ui:: AbstractAnimator:: remove(AnimationHandle handle) protected
Remove an animation.
Expects that handle
is valid. After this call, isHandleValid(AnimationHandle) const returns false
for handle
. See also remove(AnimatorDataHandle) which is a simpler operation if the data is already known to belong to this animator.
Compared to create(), play() or pause(), removing an animation never causes any animation to become AnimationState::
void Magnum:: Ui:: AbstractAnimator:: remove(AnimatorDataHandle handle) protected
Remove an animation assuming it belongs to this animator.
Like remove(AnimationHandle) but without checking that handle
indeed belongs to this animator. See its documentation for more information.
void Magnum:: Ui:: AbstractAnimator:: doClean(Containers:: BitArrayView animationIdsToRemove) virtual private
Clean no longer valid animations.
Parameters | |
---|---|
animationIdsToRemove | Animation IDs to remove |
Implementation for clean(), which is called from subclass implementations such as AbstractGenericAnimator::
This function is also called from cleanNodes() / cleanData(), which is called from AbstractUserInterface::
The animationIdsToRemove
view has the same size as capacity() and is guaranteed to have bits set only for valid animation IDs, i.e. animation IDs that are already removed are not set.
This function may get also called with animationIdsToRemove
having all bits zero.
Default implementation does nothing.