pub struct TransitionConfig {
pub enter_ms: u32,
pub exit_ms: u32,
}Expand description
Configuration for a TransitionState.
Both fields are reactive (the underlying state holds a
Signal<TransitionConfig>), so consumers can adjust
the durations at runtime via change_config and any
pending timers driven by the old config will continue
using the old values until they next read the config
signal.
Fields§
§enter_ms: u32The duration of the enter animation, in milliseconds.
exit_ms: u32The duration of the exit animation, in milliseconds.
Implementations§
Source§impl TransitionConfig
impl TransitionConfig
Sourcepub const fn with_ms(ms: u32) -> Self
pub const fn with_ms(ms: u32) -> Self
Returns a config with both enter and exit durations
set to ms.
Named with_ms (not new) to avoid colliding
with the new constructor generated by
#[derive(New)]. (We don’t derive New here
because the field name enter_ms would generate
a set_enter_ms setter that nobody asked for —
keeping the struct Copy and writing it via
TransitionConfig { enter_ms, exit_ms } is
simpler.)
Sourcepub const fn with_durations(enter_ms: u32, exit_ms: u32) -> Self
pub const fn with_durations(enter_ms: u32, exit_ms: u32) -> Self
Returns a config with separate enter and exit
durations. See with_ms for the naming note.
Sourcepub fn duration_for(&self, phase: TransitionPhase) -> u32
pub fn duration_for(&self, phase: TransitionPhase) -> u32
Returns the duration (in ms) corresponding to the
given phase. Returns 0 for terminal phases
(Entered, Exited) — these don’t tick.
Source§impl TransitionConfig
impl TransitionConfig
pub fn get_enter_ms(&self) -> u32
pub fn get_mut_enter_ms(&mut self) -> &mut u32
pub fn set_enter_ms(&mut self, val: u32) -> &mut Self
pub fn get_exit_ms(&self) -> u32
pub fn get_mut_exit_ms(&mut self) -> &mut u32
pub fn set_exit_ms(&mut self, val: u32) -> &mut Self
Trait Implementations§
Source§impl Clone for TransitionConfig
impl Clone for TransitionConfig
Source§fn clone(&self) -> TransitionConfig
fn clone(&self) -> TransitionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more