template<class K, class V, class R = ResultOf<V>>
Magnum::Animation::TrackView class

Animation track view.

Template parameters
K Key type
V Value type
R Result type

Unlike Track this is a non-owning view onto keyframe + value pairs. See its documentation for more information.

Base classes

template<class K>
class TrackViewStorage
Type-erased track view storage.

Public types

using ValueType = V
Value type.
using ResultType = R
Animation result type.
using Interpolator = ResultType(*)(const ValueType&, const ValueType&, Float)
Interpolation function.

Constructors, destructors, conversion operators

TrackView() noexcept
Construct an empty track.
TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept
Construct with custom interpolator.
TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept
TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept
Construct with custom interpolator from an interleaved array.
TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Extrapolated) explicit noexcept
TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept
Construct with both generic and custom interpolator.
TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept
TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept
Construct with both generic and custom interpolator from an interleaved array.
TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept
TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept
Construct with generic interpolation behavior.
TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept
TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept
Construct with generic interpolation behavior from an interleaved array.
TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept

Public functions

auto interpolator() const -> Interpolator
Interpolation function.
auto values() const -> Containers::StridedArrayView<const V>
Value data.
auto operator[](std::size_t i) const -> std::pair<K, V>
Keyframe access.
auto at(K frame) const -> R
Animated value at a given time.
auto at(K frame, std::size_t& hint) const -> R
Animated value at a given time.
auto at(Interpolator interpolator, K frame) const -> R
Animated value at a given time.
auto at(Interpolator interpolator, K frame, std::size_t& hint) const -> R
Animated value at a given time.
auto atStrict(K frame, std::size_t& hint) const -> R
Animated value at a given time.
auto atStrict(Interpolator interpolator, K frame, std::size_t& hint) const -> R
Animated value at a given time.

Function documentation

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView() noexcept

Construct an empty track.

The keys(), values() and interpolator() functions return nullptr, at() always returns a default-constructed value.

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept

Construct with custom interpolator.

Parameters
keys Frame keys
values Frame values
interpolator Interpolation function
before Extrapolation behavior before
after Extrapolation behavior after

The keyframe data are assumed to be stored in sorted order. It's not an error to have two successive keyframes with the same frame value. The interpolation() field is set to Interpolation::Custom. See TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolation, Interpolator, Extrapolation, Extrapolation) or TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolation, Extrapolation, Extrapolation) for an alternative.

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Equivalent to calling TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolator, Extrapolation, Extrapolation) with both before and after set to extrapolation.

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept

Construct with custom interpolator from an interleaved array.

Parameters
data Keyframe data
interpolator Interpolation function
before Extrapolation behavior before
after Extrapolation behavior after

Converts data to a pair of strided array views and calls TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolator, Extrapolation, Extrapolation).

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Extrapolated) explicit noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Equivalent to calling TrackView(Containers::ArrayView<const std::pair<K, V>>, Interpolator, Extrapolation, Extrapolation) with both before and after set to extrapolation.

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept

Construct with both generic and custom interpolator.

Parameters
keys Frame keys
values Frame values
interpolation Interpolation behavior
interpolator Interpolator function
before Extrapolation behavior before
after Extrapolation behavior after

The keyframe data are assumed to be stored in sorted order. It's not an error to have two successive keyframes with the same frame value. interpolation acts as a behavior hint to users that might want to supply their own interpolator function to at() or atStrict().

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Equivalent to calling TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolation, Interpolator, Extrapolation, Extrapolation) with both before and after set to extrapolation.

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept

Construct with both generic and custom interpolator from an interleaved array.

Parameters
data Keyframe data
interpolation Interpolation behavior
interpolator Interpolator function
before Extrapolation behavior before
after Extrapolation behavior after

Converts data to a pair of strided array views and calls TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolator, Extrapolation, Extrapolation).

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Equivalent to calling TrackView(Containers::ArrayView<const std::pair<K, V>>, Interpolation, Interpolator, Extrapolation, Extrapolation) with both before and after set to extrapolation.

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept

Construct with generic interpolation behavior.

Parameters
keys Frame keys
values Frame values
interpolation Interpolation behavior
before Extrapolation behavior before
after Extrapolation behavior after

The keyframe data are assumed to be stored in sorted order. It's not an error to have two successive keyframes with the same frame value. The interpolator() function is autodetected from interpolation using interpolatorFor(). See its documentation for more information.

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Equivalent to calling TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolation, Extrapolation, Extrapolation) with both before and after set to extrapolation.

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept

Construct with generic interpolation behavior from an interleaved array.

Parameters
data Keyframe data
interpolation Interpolation behavior
before Extrapolation behavior before
after Extrapolation behavior after

Converts data to a pair of strided array views and calls TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolator, Extrapolation, Extrapolation).

template<class K, class V, class R>
Magnum::Animation::TrackView<K, V, R>::TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Extrapolated) noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Equivalent to calling TrackView(Containers::ArrayView<const std::pair<K, V>>, Interpolation, Extrapolation, Extrapolation) with both before and after set to extrapolation.

template<class K, class V, class R>
Interpolator Magnum::Animation::TrackView<K, V, R>::interpolator() const

Interpolation function.

template<class K, class V, class R>
Containers::StridedArrayView<const V> Magnum::Animation::TrackView<K, V, R>::values() const

Value data.

template<class K, class V, class R>
std::pair<K, V> Magnum::Animation::TrackView<K, V, R>::operator[](std::size_t i) const

Keyframe access.

template<class K, class V, class R>
R Magnum::Animation::TrackView<K, V, R>::at(K frame) const

Animated value at a given time.

Calls interpolate(), see its documentation for more information. Note that this function performs a linear search every time, use at(K, std::size_t&) const to supply a search hint.

template<class K, class V, class R>
R Magnum::Animation::TrackView<K, V, R>::at(K frame, std::size_t& hint) const

Animated value at a given time.

Calls interpolate(), see its documentation for more information.

template<class K, class V, class R>
R Magnum::Animation::TrackView<K, V, R>::at(Interpolator interpolator, K frame) const

Animated value at a given time.

Unlike at(K) const calls interpolate() with interpolator, overriding the interpolator function set in constructor. See its documentation for more information.

template<class K, class V, class R>
R Magnum::Animation::TrackView<K, V, R>::at(Interpolator interpolator, K frame, std::size_t& hint) const

Animated value at a given time.

Unlike at(K, std::size_t&) const calls interpolate() with interpolator, overriding the interpolator function set in constructor. See its documentation for more information.

template<class K, class V, class R>
R Magnum::Animation::TrackView<K, V, R>::atStrict(K frame, std::size_t& hint) const

Animated value at a given time.

A faster version of at(K, std::size_t&) const with some restrictions. Calls interpolateStrict(), see its documentation for more information.

template<class K, class V, class R>
R Magnum::Animation::TrackView<K, V, R>::atStrict(Interpolator interpolator, K frame, std::size_t& hint) const

Animated value at a given time.

Unlike atStrict(K, std::size_t&) const calls interpolate() with interpolator, overriding the interpolator function set in constructor. See its documentation for more information.