pub struct ScreenTransition {
pub ease: Ease,
/* private fields */
}Expand description
Cover → swap → reveal timing for scene changes (wipe, iris or fade).
Under reduced motion ScreenTransition::kind reports TransitionKind::Fade.
use ferravex_play::tween::{Motion, ScreenTransition, TransitionEvent, TransitionKind, TransitionPhase};
let mut t = ScreenTransition::new(TransitionKind::Iris, 0.4);
t.cover();
let mut events = Vec::new();
for _ in 0..60 {
if let Some(e) = t.advance(1. / 60., Motion::Full) {
events.push(e);
if e == TransitionEvent::Covered { t.reveal(); } // load the next scene here
}
}
assert_eq!(events, [TransitionEvent::Covered, TransitionEvent::Revealed]);
assert_eq!((t.phase(), t.coverage()), (TransitionPhase::Idle, 0.));
assert_eq!(t.kind(Motion::Reduced), TransitionKind::Fade);Fields§
§ease: EaseImplementations§
Source§impl ScreenTransition
impl ScreenTransition
Sourcepub fn new(kind: TransitionKind, duration: f32) -> ScreenTransition
pub fn new(kind: TransitionKind, duration: f32) -> ScreenTransition
duration is the time for each half (cover and reveal).
pub fn phase(&self) -> TransitionPhase
Sourcepub fn kind(&self, motion: Motion) -> TransitionKind
pub fn kind(&self, motion: Motion) -> TransitionKind
The kind to draw this frame (reduced motion draws a fade).
Trait Implementations§
Source§impl Clone for ScreenTransition
impl Clone for ScreenTransition
Source§fn clone(&self) -> ScreenTransition
fn clone(&self) -> ScreenTransition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScreenTransition
impl Debug for ScreenTransition
Source§impl PartialEq for ScreenTransition
impl PartialEq for ScreenTransition
impl Copy for ScreenTransition
impl StructuralPartialEq for ScreenTransition
Auto Trait Implementations§
impl Freeze for ScreenTransition
impl RefUnwindSafe for ScreenTransition
impl Send for ScreenTransition
impl Sync for ScreenTransition
impl Unpin for ScreenTransition
impl UnwindSafe for ScreenTransition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more