pub struct ExponentialInertia {
pub position_x: f32,
pub position_y: f32,
pub velocity_x: f32,
pub velocity_y: f32,
/* private fields */
}Expand description
Exponentially decaying inertial motion with exact time integration.
Fields§
§position_x: f32Current offset in pixels.
position_y: f32Current offset in pixels.
velocity_x: f32Current velocity in pixels per second.
velocity_y: f32Current velocity in pixels per second.
Implementations§
Source§impl ExponentialInertia
impl ExponentialInertia
Sourcepub fn new(
position_x: f32,
position_y: f32,
velocity: ScrollVelocity,
decay_rate: f32,
) -> Self
pub fn new( position_x: f32, position_y: f32, velocity: ScrollVelocity, decay_rate: f32, ) -> Self
Creates inertial motion with a positive decay rate in inverse seconds.
Sourcepub fn advance(&mut self, dt: Duration) -> ScrollVelocity
pub fn advance(&mut self, dt: Duration) -> ScrollVelocity
Advances motion by dt, returning the integrated displacement.
Sourcepub fn velocity(&self) -> ScrollVelocity
pub fn velocity(&self) -> ScrollVelocity
Returns the current velocity.
Trait Implementations§
Source§impl Clone for ExponentialInertia
impl Clone for ExponentialInertia
Source§fn clone(&self) -> ExponentialInertia
fn clone(&self) -> ExponentialInertia
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ExponentialInertia
Source§impl Debug for ExponentialInertia
impl Debug for ExponentialInertia
Source§impl PartialEq for ExponentialInertia
impl PartialEq for ExponentialInertia
impl StructuralPartialEq for ExponentialInertia
Auto Trait Implementations§
impl Freeze for ExponentialInertia
impl RefUnwindSafe for ExponentialInertia
impl Send for ExponentialInertia
impl Sync for ExponentialInertia
impl Unpin for ExponentialInertia
impl UnsafeUnpin for ExponentialInertia
impl UnwindSafe for ExponentialInertia
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.