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

Base for generic animators.

Base classes

class AbstractAnimator new in Git master
Base for animators.

Constructors, destructors, conversion operators

AbstractGenericAnimator(AnimatorHandle handle) explicit
Constructor.
AbstractGenericAnimator(const AbstractGenericAnimator&) deleted
Copying is not allowed.
AbstractGenericAnimator(AbstractGenericAnimator&&) noexcept
Move constructor.

Public functions

auto operator=(const AbstractGenericAnimator&) -> AbstractGenericAnimator& deleted
Copying is not allowed.
auto operator=(AbstractGenericAnimator&&) -> AbstractGenericAnimator& noexcept
Move assignment.
void advance(Containers::BitArrayView active, const Containers::StridedArrayView1D<const Float>& factors)
Advance the animations.

Protected functions

void setLayer(const AbstractLayer& layer)
Set a layer associated with this animator.

Private functions

void doAdvance(Containers::BitArrayView active, const Containers::StridedArrayView1D<const Float>& factors) pure virtual
Advance the animations.

Function documentation

Magnum::Ui::AbstractGenericAnimator::AbstractGenericAnimator(AnimatorHandle handle) explicit

Constructor.

Parameters
handle Handle returned by AbstractUserInterface::createAnimator()

Magnum::Ui::AbstractGenericAnimator::AbstractGenericAnimator(AbstractGenericAnimator&&) noexcept

Move constructor.

Performs a destructive move, i.e. the original object isn't usable afterwards anymore.

void Magnum::Ui::AbstractGenericAnimator::advance(Containers::BitArrayView active, const Containers::StridedArrayView1D<const Float>& factors)

Advance the animations.

Used internally from AbstractUserInterface::advanceAnimations(). Exposed just for testing purposes, there should be no need to call this function directly and doing so may cause internal AbstractUserInterface state update to misbehave.

Expects that size of active and factors matches capacity(), it's assumed that their contents were filled by update() before. Delegates to doAdvance(), see its documentation for more information.

void Magnum::Ui::AbstractGenericAnimator::setLayer(const AbstractLayer& layer) protected

Set a layer associated with this animator.

Expects that the animator supports AnimatorFeature::DataAttachment and that this function hasn't been called yet. Saves AbstractLayer::handle() of layer into layer(), making it possible to call create(Nanoseconds, Nanoseconds, DataHandle, UnsignedInt, AnimationFlags), create(Nanoseconds, Nanoseconds, LayerDataHandle, UnsignedInt, AnimationFlags), attach(AnimationHandle, DataHandle), attach(AnimationHandle, LayerDataHandle), attach(AnimatorDataHandle, DataHandle) and attach(AnimatorDataHandle, LayerDataHandle).

A concrete subclass exposing AnimatorFeature::DataAttachment is meant to wrap this function in a public API, optionally restricting to a more concrete layer type, and performing any needed initialization work there, or alternatively taking an appropriately typed layer in a constructor and passing it to this function.

A corresponding API for an AbstractDataAnimator / AbstractStyleAnimator is AbstractLayer::assignAnimator(AbstractDataAnimator&) const / AbstractLayer::assignAnimator(AbstractStyleAnimator&) const, where the layer has the control over a concrete animator type instead.

void Magnum::Ui::AbstractGenericAnimator::doAdvance(Containers::BitArrayView active, const Containers::StridedArrayView1D<const Float>& factors) pure virtual private

Advance the animations.

Parameters
active Animation IDs that are active
factors Interpolation factors indexed by animation ID

Implementation for advance(), which is called from AbstractUserInterface::advanceAnimations() whenever AnimatorState::NeedsAdvance is present in state().

The active and factors views are guaranteed to have the same size as capacity(). The factors array is guaranteed to contain values in the $ [0, 1] $ range for animations that have a corresponding bit set in active, calculated equivalently to factor(AnimationHandle) const, and may contain random or uninitialized values for others. This function is always called with at least one active bit set.