[−][src]Trait yoyo_physics::Curve
Curves provide the mathematical foundation for animation.
Within Yoyo, we restrict curves to those with a closed-form approximation / analytical solution and similarly, a closed-form derivative that we can use to compute velocity. Typically, especially for springs, animation frameworks use numerical integrations, like RK4. We want closed-form solutions because they let us pause and resume animations at arbitrary time steps.
Associated Types
type Value
This is the type that this curve operates on.
type Velocity
This is the type of velocity that this curve works with.
Required methods
fn approximate(&self, time: f32) -> Approximation<Self::Value, Self::Velocity>
This should return a single approximation for the given time.
fn target(&self) -> Self::Value
This should return the target value of this curve.
Implementors
impl<T> Curve for Bezier<T> where
T: Float,
[src]
T: Float,
type Value = T
type Velocity = T
fn approximate(&self, time: f32) -> Approximation<T>
[src]
fn target(&self) -> T
[src]
impl<T> Curve for Decay<T> where
T: Float,
[src]
T: Float,
type Value = T
type Velocity = T
fn approximate(&self, time: f32) -> Approximation<T>
[src]
fn target(&self) -> T
[src]
impl<T> Curve for Delay<T> where
T: Float,
[src]
T: Float,
type Value = T
type Velocity = T
fn approximate(&self, time: f32) -> Approximation<T>
[src]
fn target(&self) -> T
[src]
impl<T> Curve for Spring<T> where
T: Float,
[src]
T: Float,
type Value = T
type Velocity = T
fn approximate(&self, time: f32) -> Approximation<T>
[src]
This function approximates a spring's oscillation and velocity at the given timestamp.