Unified motion primitive: one value of type T transitioning from start to target over time, driven by a curve and a clock. More...
#include <phosphor-animation/include/PhosphorAnimation/AnimatedValue.h>
Public Member Functions | |
| AnimatedValue ()=default | |
| ~AnimatedValue ()=default | |
| AnimatedValue (const AnimatedValue &)=delete | |
| AnimatedValue & | operator= (const AnimatedValue &)=delete |
| AnimatedValue (AnimatedValue &&) noexcept=default | |
| AnimatedValue & | operator= (AnimatedValue &&) noexcept=default |
| bool | start (T from, T to, MotionSpec< T > spec) |
| Begin an animation. Returns false if degenerate (from == to) or invalid. | |
| bool | retarget (T newTo, RetargetPolicy policy) |
| Redirect in-flight animation to a new target. | |
| bool | retarget (T newTo) |
| Convenience overload using m_spec.retargetPolicy. | |
| void | rebindClock (IMotionClock *newClock) |
| Swap the driving clock without touching target/state/interpolation. | |
| void | cancel () |
| Stop animating; leave value() at its current position. | |
| template<ColorSpace OtherSpace> | |
| void | seedFrom (const AnimatedValue< T, OtherSpace > &other) |
| Cross-Space idle-state copy for color-space wrapper dispatch. | |
| template<ColorSpace OtherSpace> | |
| void | seedSpecFrom (const AnimatedValue< T, OtherSpace > &other) |
| Companion to seedFrom — copies clock + callbacks, leaves profile alone. | |
| void | finish () |
| Snap to target immediately, fire onValueChanged + onComplete. | |
| void | advance () |
| Advance animation by one paint tick. | |
| T | value () const |
| qreal | velocity () const |
| const CurveState & | state () const |
| bool | isAnimating () const |
| bool | isComplete () const |
| const MotionSpec< T > & | spec () const |
| T | from () const |
| T | to () const |
| QRectF | bounds () const |
| Bounding rectangle of the swept path including curve overshoot. | |
| QRectF | boundsAt (QPointF anchor) const |
Damage rect anchored at anchor — QSizeF specialisation only. | |
| std::pair< QSizeF, QSizeF > | sweptSize () const |
| (minSize, maxSize) the animation sweeps through, including overshoot. | |
| bool | hasSizeChange (qreal epsilonPx=kRectSizeEpsilonPx) const |
True when current size diverges from target by > epsilonPx on either axis. | |
| std::pair< T, T > | sweptRange () const |
| (lo, hi) of a scalar animation's swept range, with overshoot. | |
Static Public Member Functions | |
| static constexpr std::chrono::seconds | safetyCap () noexcept |
Unified motion primitive: one value of type T transitioning from start to target over time, driven by a curve and a clock.
Move-only. GUI-thread only (matches IMotionClock's contract).
|
default |
|
default |
|
delete |
|
defaultnoexcept |
|
inline |
Advance animation by one paint tick.
No-op when not animating. Spec callbacks must NOT destroy *this while running (see header).
| QRectF PhosphorAnimation::AnimatedValue< T, Space >::bounds | ( | ) | const |
Bounding rectangle of the swept path including curve overshoot.
| QRectF PhosphorAnimation::AnimatedValue< T, Space >::boundsAt | ( | QPointF | anchor | ) | const |
Damage rect anchored at anchor — QSizeF specialisation only.
|
inline |
Stop animating; leave value() at its current position.
Does not fire onComplete — cancellation is non-completion. Leaves isAnimating() AND isComplete() both false.
|
inline |
Snap to target immediately, fire onValueChanged + onComplete.
|
inline |
| bool PhosphorAnimation::AnimatedValue< T, Space >::hasSizeChange | ( | qreal | epsilonPx = kRectSizeEpsilonPx | ) | const |
True when current size diverges from target by > epsilonPx on either axis.
|
inline |
|
inline |
|
defaultnoexcept |
|
delete |
| void PhosphorAnimation::AnimatedValue< T, Space >::rebindClock | ( | IMotionClock * | newClock | ) |
Swap the driving clock without touching target/state/interpolation.
Swap the driving clock without touching target, state, or interpolation.
Rebases latched timestamps so elapsed/dt survive unchanged across the swap. Both clocks must share an epoch (epochCompatible); incompatible pairs are refused. Passing nullptr cancels the animation.
|
inline |
Convenience overload using m_spec.retargetPolicy.
|
inline |
Redirect in-flight animation to a new target.
Returns false on rejection (no stored spec) or degenerate target (complete-in-place).
|
inlinestaticconstexprnoexcept |
| void PhosphorAnimation::AnimatedValue< T, Space >::seedFrom | ( | const AnimatedValue< T, OtherSpace > & | other | ) |
Cross-Space idle-state copy for color-space wrapper dispatch.
Copy idle state (from, to, current, isComplete) from a sibling that differs only in ColorSpace.
No-op if either side is animating.
| void PhosphorAnimation::AnimatedValue< T, Space >::seedSpecFrom | ( | const AnimatedValue< T, OtherSpace > & | other | ) |
Companion to seedFrom — copies clock + callbacks, leaves profile alone.
Copy clock + callbacks from a sibling's MotionSpec, leaving profile alone.
Keeps the target instance retarget-able after a space flip. Idle-only.
|
inline |
|
inline |
Begin an animation. Returns false if degenerate (from == to) or invalid.
|
inline |
| std::pair< T, T > PhosphorAnimation::AnimatedValue< T, Space >::sweptRange | ( | ) | const |
(lo, hi) of a scalar animation's swept range, with overshoot.
| std::pair< QSizeF, QSizeF > PhosphorAnimation::AnimatedValue< T, Space >::sweptSize | ( | ) | const |
(minSize, maxSize) the animation sweeps through, including overshoot.
|
inline |
|
inline |
|
inline |