Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorAnimation::MotionSpec< T > Struct Template Reference

Runtime call-site bundle for starting an AnimatedValue<T>. More...

#include <phosphor-animation/include/PhosphorAnimation/MotionSpec.h>

Public Attributes

Profile profile
 
IMotionClockclock = nullptr
 Non-owning; non-null required.
 
RetargetPolicy retargetPolicy = RetargetPolicy::PreserveVelocity
 
std::optional< int > maxLifetimeMs
 Optional hard ceiling on a STATEFUL (spring) animation's lifetime, in ms.
 
std::function< void(const T &)> onValueChanged
 Fired every advance() that changes value().
 
std::function< void()> onComplete
 Fired once on completion. Not fired on cancel().
 

Detailed Description

template<typename T>
struct PhosphorAnimation::MotionSpec< T >

Runtime call-site bundle for starting an AnimatedValue<T>.

Profile is the serializable config surface; MotionSpec adds per-animation runtime concerns: clock, retarget policy, callbacks. Clock is non-owning (outlives all AnimatedValues). Callbacks MUST NOT throw — the library does not catch exceptions out of them.

Member Data Documentation

◆ clock

template<typename T >
IMotionClock* PhosphorAnimation::MotionSpec< T >::clock = nullptr

Non-owning; non-null required.

◆ maxLifetimeMs

template<typename T >
std::optional<int> PhosphorAnimation::MotionSpec< T >::maxLifetimeMs

Optional hard ceiling on a STATEFUL (spring) animation's lifetime, in ms.

A spring ignores profile.duration — it runs on its own physics — so the duration envelope cannot bound it and advance() otherwise ends it at the curve's raw settleTime(), itself capped only by Spring's internal 30 s. A consumer that has ALREADY resolved a lifetime for the same curve on another leg passes it here, so this animation can never OUTLIVE that leg. (It may still finish EARLIER — a spring that settles below the consumer's floor completes on its own physics — which is harmless.)

The compositor needs this: its shader leg cuts a transition at MaxAnimationDurationMs (2 s) via ShaderInternal::resolveTransitionLifetimeMs, while a slider-reachable soft spring (zeta*omega < 2.649, e.g. "spring:10,0.15") settles in 3.5 s and would leave the geometry animation requesting frames for seconds after its shader was gone.

The library imposes NO default: std::nullopt keeps the pure-physics behaviour, which is correct for consumers deliberately outside the compositor's envelope (the daemon's SurfaceAnimator). See AnimationLimits.h.

◆ onComplete

template<typename T >
std::function<void()> PhosphorAnimation::MotionSpec< T >::onComplete

Fired once on completion. Not fired on cancel().

◆ onValueChanged

template<typename T >
std::function<void(const T&)> PhosphorAnimation::MotionSpec< T >::onValueChanged

Fired every advance() that changes value().

Wire damage/invalidation here. When using AnimationController, prefer its virtual hooks instead.

◆ profile

template<typename T >
Profile PhosphorAnimation::MotionSpec< T >::profile

◆ retargetPolicy


The documentation for this struct was generated from the following file: