1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Behavior helpers for property-driven animation.
//!
//! Use this module when a view value should animate because its target value
//! changed. A [`BehaviorRule`] stores reusable property and timing settings,
//! and binding it to an [`AnimationTargetId`](crate::AnimationTargetId) creates
//! a [`PropertyTransition`] that owns the current target value and active
//! runtime handle.
//!
//! ```
//! use aura_anim_iced::{
//! AnimationRuntime, AnimationTargetId, BehaviorRule, Duration, PropertyValue,
//! Timing, WIDTH,
//! };
//!
//! let mut runtime = AnimationRuntime::testing();
//! let target = AnimationTargetId::new();
//! let rule = BehaviorRule::new(WIDTH).with_timing(Timing::new(100.0));
//! let mut width = rule.bind(target);
//!
//! // The first value seeds the baseline and does not animate.
//! assert!(width.transition_to(&mut runtime, 120.0).is_none());
//!
//! let registration = width
//! .transition_to(&mut runtime, 240.0)
//! .expect("changed target starts an animation");
//! assert_eq!(width.active_handle(), Some(registration.handle()));
//!
//! runtime.clock_mut().set_now(Duration::from_millis(50.0));
//! let tick = runtime.tick();
//! let snapshot = tick.properties_for(target).expect("target output");
//! let entry = snapshot.find_property(&WIDTH.raw()).expect("width output");
//!
//! assert!(matches!(entry.value(), PropertyValue::Scalar(value) if (*value - 180.0).abs() < 0.001));
//! ```
pub use ;
pub use PropertyTransitionRegistration;
pub use BehaviorRule;
pub use PropertyTransition;
pub use TransitionValueKind;