Skip to main content

AnimationManager

Struct AnimationManager 

Source
pub struct AnimationManager<K: Eq + Hash + Copy> { /* private fields */ }
Expand description

Central, Qt-style animation driver, generic over any hashable key type so it can be reused outside of any specific GUI framework. Callers never own a timer themselves; they only report their current target value and the manager owns the entire lifecycle (starting, easing, retargeting, finishing).

Implementations§

Source§

impl<K: Eq + Hash + Copy> AnimationManager<K>

Source

pub fn new() -> Self

Creates an empty manager with no active or resting animations.

Source

pub fn set_target( &mut self, key: K, target: AnimValue, transition: Option<Transition>, )

Source

pub fn set_color_target( &mut self, key: K, target: AnimValue, transition: Option<Transition>, )

Like set_target, but blends the transition using premultiplied alpha - use this when target packs an RGBA color, so a transparent endpoint’s meaningless RGB doesn’t leak into the blend as a visible flash partway through the fade.

Source

pub fn tick(&mut self, dt: Duration)

Advances every active transition by one frame’s delta time. Call exactly once per frame, before layout/paint.

Source

pub fn value(&self, key: K) -> Option<AnimValue>

Current (possibly mid-transition) value for key, or None once the transition has settled - callers should fall back to their own resolved target value in that case.

Source

pub fn active_keys(&self) -> impl Iterator<Item = &K>

Iterates the keys of every animation currently mid-transition, letting callers check what is animating instead of only whether anything is - e.g. to skip layout work for animations that only affect paint (colors, opacity) and not the box model.

Source

pub fn is_animating(&self) -> bool

Whether any animation is currently in flight across all keys. Useful to decide whether the render loop needs to keep polling for frames.

Trait Implementations§

Source§

impl<K: Eq + Hash + Copy> Default for AnimationManager<K>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<K> Freeze for AnimationManager<K>

§

impl<K> RefUnwindSafe for AnimationManager<K>
where K: RefUnwindSafe,

§

impl<K> Send for AnimationManager<K>
where K: Send,

§

impl<K> Sync for AnimationManager<K>
where K: Sync,

§

impl<K> Unpin for AnimationManager<K>
where K: Unpin,

§

impl<K> UnsafeUnpin for AnimationManager<K>

§

impl<K> UnwindSafe for AnimationManager<K>
where K: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.