aura_anim_iced/runtime/
registration.rs1use super::{AnimationHandle, AnimationPlaybackState};
2use crate::{
3 AnimationTargetId, property::PropertySnapshot, runtime::entry::ActiveAnimation,
4 timing::Duration,
5};
6
7#[derive(Debug, Clone, PartialEq)]
9pub struct AnimationRegistration {
10 target: AnimationTargetId,
11 handle: AnimationHandle,
12 state: AnimationPlaybackState,
13 properties: Option<PropertySnapshot>,
14 completed_at: Option<Duration>,
15}
16
17impl AnimationRegistration {
18 pub(super) fn from_entry(entry: &ActiveAnimation) -> Self {
19 Self {
20 target: entry.target(),
21 handle: entry.handle(),
22 state: entry.state(),
23 properties: entry.last_snapshot().cloned(),
24 completed_at: entry.completed_at(),
25 }
26 }
27
28 #[must_use]
30 pub const fn handle(&self) -> AnimationHandle {
31 self.handle
32 }
33
34 #[must_use]
36 pub const fn state(&self) -> AnimationPlaybackState {
37 self.state
38 }
39
40 #[must_use]
42 pub const fn properties(&self) -> Option<&PropertySnapshot> {
43 self.properties.as_ref()
44 }
45
46 #[must_use]
48 pub const fn completed_at(&self) -> Option<Duration> {
49 self.completed_at
50 }
51}