pub struct ButtonMotion { /* private fields */ }Expand description
Eased hover/press/focus amounts for one button (critically damped springs, so state changes glide without overshoot). Keep one per button.
use ferravex_play::tween::Motion;
use ferravex_render::ui::kit::{ButtonMotion, ButtonState};
let mut m = ButtonMotion::default();
let hover = ButtonState { hovered: true, ..ButtonState::default() };
m.update(hover, 1. / 60., Motion::Full);
assert!(m.hover() > 0. && m.hover() < 1.);
m.update(hover, 1. / 60., Motion::Reduced);
assert_eq!(m.hover(), 1.);Implementations§
Trait Implementations§
Source§impl Clone for ButtonMotion
impl Clone for ButtonMotion
Source§fn clone(&self) -> ButtonMotion
fn clone(&self) -> ButtonMotion
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 ButtonMotion
impl Debug for ButtonMotion
Source§impl Default for ButtonMotion
impl Default for ButtonMotion
Source§fn default() -> ButtonMotion
fn default() -> ButtonMotion
Returns the “default value” for a type. Read more
Source§impl PartialEq for ButtonMotion
impl PartialEq for ButtonMotion
impl Copy for ButtonMotion
impl StructuralPartialEq for ButtonMotion
Auto Trait Implementations§
impl Freeze for ButtonMotion
impl RefUnwindSafe for ButtonMotion
impl Send for ButtonMotion
impl Sync for ButtonMotion
impl Unpin for ButtonMotion
impl UnwindSafe for ButtonMotion
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