pub struct Inertia2D { /* private fields */ }Expand description
2D inertia animation.
Implementations§
Source§impl Inertia2D
impl Inertia2D
Sourcepub fn new(
x: f32,
y: f32,
velocity_x: f32,
velocity_y: f32,
friction: f32,
min_velocity: f32,
) -> Self
pub fn new( x: f32, y: f32, velocity_x: f32, velocity_y: f32, friction: f32, min_velocity: f32, ) -> Self
Create 2D inertia.
Sourcepub fn set_bounds(&self, min_x: f32, max_x: f32, min_y: f32, max_y: f32)
pub fn set_bounds(&self, min_x: f32, max_x: f32, min_y: f32, max_y: f32)
Set inclusive 2D bounds.
Sourcepub fn to_array(&self) -> Float32Array
pub fn to_array(&self) -> Float32Array
Current position.
Sourcepub fn velocity_array(&self) -> Float32Array
pub fn velocity_array(&self) -> Float32Array
Current velocity.
Sourcepub fn is_settled(&self) -> bool
pub fn is_settled(&self) -> bool
Whether inertia has settled.
Trait Implementations§
Source§impl FromWasmAbi for Inertia2D
impl FromWasmAbi for Inertia2D
Source§impl IntoWasmAbi for Inertia2D
impl IntoWasmAbi for Inertia2D
Source§impl LongRefFromWasmAbi for Inertia2D
impl LongRefFromWasmAbi for Inertia2D
Source§impl OptionFromWasmAbi for Inertia2D
impl OptionFromWasmAbi for Inertia2D
Source§impl OptionIntoWasmAbi for Inertia2D
impl OptionIntoWasmAbi for Inertia2D
Source§impl RefFromWasmAbi for Inertia2D
impl RefFromWasmAbi for Inertia2D
Source§type Abi = WasmPtr<WasmRefCell<Inertia2D>>
type Abi = WasmPtr<WasmRefCell<Inertia2D>>
The Wasm ABI type references to
Self are recovered from.Source§impl RefMutFromWasmAbi for Inertia2D
impl RefMutFromWasmAbi for Inertia2D
Source§impl TryFromJsValue for Inertia2D
impl TryFromJsValue for Inertia2D
Source§impl VectorFromWasmAbi for Inertia2D
impl VectorFromWasmAbi for Inertia2D
Source§impl VectorIntoWasmAbi for Inertia2D
impl VectorIntoWasmAbi for Inertia2D
impl SupportsConstructor for Inertia2D
impl SupportsInstanceProperty for Inertia2D
impl SupportsStaticProperty for Inertia2D
Auto Trait Implementations§
impl Freeze for Inertia2D
impl RefUnwindSafe for Inertia2D
impl Send for Inertia2D
impl Sync for Inertia2D
impl Unpin for Inertia2D
impl UnsafeUnpin for Inertia2D
impl UnwindSafe for Inertia2D
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.