pub struct Inertia { /* private fields */ }Expand description
Scalar inertia animation.
Implementations§
Source§impl Inertia
impl Inertia
Sourcepub fn new(
position: f32,
velocity: f32,
friction: f32,
min_velocity: f32,
) -> Self
pub fn new( position: f32, velocity: f32, friction: f32, min_velocity: f32, ) -> Self
Create inertia with initial position, velocity, friction, and min velocity.
Sourcepub fn with_preset(
position: f32,
velocity: f32,
preset: &str,
) -> Result<Inertia, JsValue>
pub fn with_preset( position: f32, velocity: f32, preset: &str, ) -> Result<Inertia, JsValue>
Use a named preset: smooth, snappy, or heavy.
Sourcepub fn set_bounds(&self, min: f32, max: f32)
pub fn set_bounds(&self, min: f32, max: f32)
Set inclusive bounds.
Sourcepub fn is_settled(&self) -> bool
pub fn is_settled(&self) -> bool
Whether inertia has settled.
Trait Implementations§
Source§impl FromWasmAbi for Inertia
impl FromWasmAbi for Inertia
Source§impl IntoWasmAbi for Inertia
impl IntoWasmAbi for Inertia
Source§impl LongRefFromWasmAbi for Inertia
impl LongRefFromWasmAbi for Inertia
Source§impl OptionFromWasmAbi for Inertia
impl OptionFromWasmAbi for Inertia
Source§impl OptionIntoWasmAbi for Inertia
impl OptionIntoWasmAbi for Inertia
Source§impl RefFromWasmAbi for Inertia
impl RefFromWasmAbi for Inertia
Source§type Abi = WasmPtr<WasmRefCell<Inertia>>
type Abi = WasmPtr<WasmRefCell<Inertia>>
The Wasm ABI type references to
Self are recovered from.Source§impl RefMutFromWasmAbi for Inertia
impl RefMutFromWasmAbi for Inertia
Source§impl TryFromJsValue for Inertia
impl TryFromJsValue for Inertia
Source§impl VectorFromWasmAbi for Inertia
impl VectorFromWasmAbi for Inertia
Source§impl VectorIntoWasmAbi for Inertia
impl VectorIntoWasmAbi for Inertia
impl SupportsConstructor for Inertia
impl SupportsInstanceProperty for Inertia
impl SupportsStaticProperty for Inertia
Auto Trait Implementations§
impl Freeze for Inertia
impl RefUnwindSafe for Inertia
impl Send for Inertia
impl Sync for Inertia
impl Unpin for Inertia
impl UnsafeUnpin for Inertia
impl UnwindSafe for Inertia
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.