pub trait EasingFunction {
    fn y(&self, x: f64) -> f64;
}
Expand description

Implementation of a 2D curve function for easing between two points

Required Methods

For an X position on the curve, calculate the Y position. 0.0-1.0 is start and end on both axes but values can go out of bounds.

Note

Because this method has a &self argument this trait can be used to both implement a “static” curve function (e.g. a linear interpolation) or a “dynamic” curve function (e.g. a bezier curve with user defined inputs).

Since a static curve function will have zero size the size of a dyn EasingFunction will be the same size as a vtable. This also means you can specify a static curve function with only the name of the type (e.g. ease(EaseInOut, 0.0, 1.0, 0.5)).

Implementors