[][src]Struct yoyo_physics::spring::Spring

pub struct Spring<T> where
    T: Float
{ pub from_value: T, pub to_value: T, pub stiffness: T, pub damping: T, pub mass: T, pub initial_velocity: T, pub allows_overdamping: bool, pub overshoot_clamping: bool, }

This is a spring whose oscillation and velocity we can efficiently approximate.

Fields

from_value: T

Starting value of the animation.

to_value: T

Ending value of the animation.

stiffness: T

The spring stiffness coefficient.

damping: T

Defines how the spring's motion should be damped due to the forces of friction.

mass: T

The mass of the object attached to the end of the spring.

initial_velocity: T

The initial velocity (in units/ms) of the object attached to the spring.

allows_overdamping: bool

Whether or not the spring allows "overdamping" (a damping ratio > 1).

overshoot_clamping: bool

False when overshooting is allowed, true when it is not.

Trait Implementations

impl<T: Clone> Clone for Spring<T> where
    T: Float
[src]

impl<T: Copy> Copy for Spring<T> where
    T: Float
[src]

impl<T> Curve for Spring<T> where
    T: Float
[src]

type Value = T

This is the type that this curve operates on.

type Velocity = T

This is the type of velocity that this curve works with.

pub fn approximate(&self, time: f32) -> Approximation<T>[src]

This function approximates a spring's oscillation and velocity at the given timestamp.

impl<T: Debug> Debug for Spring<T> where
    T: Float
[src]

impl<T> Default for Spring<T> where
    T: Float
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Spring<T> where
    T: RefUnwindSafe

impl<T> Send for Spring<T> where
    T: Send

impl<T> Sync for Spring<T> where
    T: Sync

impl<T> Unpin for Spring<T> where
    T: Unpin

impl<T> UnwindSafe for Spring<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.