Skip to main content

euv_ui/hook/transition/
enum.rs

1use super::*;
2
3/// The four phases of a transition lifecycle.
4///
5/// Lifecycle: `Exited` → `Entering` → `Entered` →
6/// `Exiting` → `Exited` (looping back). The state
7/// machine is symmetric on the way in and out — the
8/// `Entering` and `Exiting` phases both have a `progress`
9/// value in `(0.0, 1.0)`, while `Entered` and `Exited`
10/// are terminal resting states (`progress` pinned to
11/// `1.0` and `0.0` respectively).
12///
13/// Phases are public and `Clone + Copy + PartialEq` so
14/// consumers can write `match phase { ... }` and dispatch
15/// on them without going through the signal indirection
16/// every time.
17///
18/// Note: not deriving `Data` / `New` from lombok because
19/// both `Data` and `New` derive macros are only
20/// supported for structs (see `UNSUPPORTED_DATA_DERIVE`
21/// in lombok-macros 2.0.36). The standard library
22/// derives below are sufficient — we don't need
23/// getters/setters on the variants.
24#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
25pub enum TransitionPhase {
26    /// The element is not yet on-screen (initial state).
27    /// `progress` is `0.0`.
28    Exited,
29    /// The element is animating in. `progress` rises from
30    /// `0.0` toward `1.0` as `tick(elapsed_ms)` is called.
31    Entering,
32    /// The element is fully on-screen. `progress` is
33    /// `1.0`.
34    Entered,
35    /// The element is animating out. `progress` falls from
36    /// `1.0` toward `0.0` as `tick(elapsed_ms)` is called.
37    Exiting,
38}