vizia_core/animation/
animation_id.rs
1use vizia_id::{
2 impl_generational_id, GenerationalId, GENERATIONAL_ID_GENERATION_MASK,
3 GENERATIONAL_ID_INDEX_BITS, GENERATIONAL_ID_INDEX_MASK,
4};
5
6use crate::context::EventContext;
7
8#[derive(Clone, Copy, PartialEq, Eq, Hash)]
10pub struct Animation(u64);
11
12impl_generational_id!(Animation);
13
14pub trait AnimId {
16 fn get(&self, cx: &EventContext) -> Option<Animation>;
18}
19
20impl AnimId for Animation {
21 fn get(&self, _cx: &EventContext) -> Option<Animation> {
22 Some(*self)
23 }
24}
25
26impl AnimId for &'static str {
27 fn get(&self, cx: &EventContext) -> Option<Animation> {
28 cx.style.get_animation(self).copied()
29 }
30}