mod interpolator

InterpolationFunction trait and some interpolation functions.

Traits

An interpolation-function that is parameterized to allow calculating the time it should take to interpolate from from to to.

The passed argument is the same as for the InterpolationFunction.

Functions

Implemented for

An interpolation function which can interpolate values of type T, using values of type A as arguments.

Variables

The Endpoint of this InterpolationFunction (i.e., whether it will loop back to the start value or not).

Functions

Interpolate between two values based on the passed normalized fraction.

The passed argument can be used by this interpolation-functions.

Implemented for

Enums

Optional argument for Constant to describe when the constant jump should happen.

Jump at start of interpolation

Jump at end of interpolation

The endpoint of an interpolation function

The interpolation-function ends back at the from-point

The interpolation function ends at the to-point (most interpolation functions)

Implementations

Functions

Gets the passed argument based on the value of this Endpoint

Structs and Unions

Implementations

Functions

Gets the average velocity for a 2d move from source to destination in time

Component-Wise interpolator for a Position. Interpolates x- and y-coordinates separately using the same passed interpolator. The components are both interpreted in the same duration.

Note that while it is possible to wrap any types here, only wrapped InterpolationFunctions will make this type be an InterpolationFunction.

Traits implemented

Component-Wise interpolator for a Position. Interpolates x- and y-coordinates separately using the same passed interpolator. The duration must be calculable so that each component may take its specified time. The components therefore only take as long as necessary.

Note that while it is possible to wrap any types here, only wrapped InterpolationFunctions will make this type be an InterpolationFunction.

Traits implemented

Constant interpolation

Will switch from from to to at the specified point. The time can be specified by the argument:

Traits implemented

A ConstantJerkImpl with a constant jerk.

Implementations

Functions

Creates a new ConstantJerk interpolation-function with the specified fixed jerk.

Traits implemented

A ConstantJerkImpl with a set average velocity. The jerk value is calculated from the average velocity for a given interpolation.

Implementations

Functions

Calculates the jerk for a diagonal move from from to to in the passed duration.

Calculates the jerk for a one-dimensional move from from to to in the passed duration.

Traits implemented

Implementation using AverageVelocity. Use this when needing the correct values..

Implementation using no argument, as the AverageVelocity reduces in the final interpolation. Use this for interpolation in the timeline.

A ConstantJerkImpl with a set maximum velocity. The jerk value is calculated from the maximum velocity for a given interpolation.

Implementations

Functions

Traits implemented

A cubic interpolation

Will interpolate from from to to using cubic functions. Taken from easings.net

Traits implemented

Diagonal interpolator for a Position. Interpolates the direct (diagonal) connection between from and to.

Note that while it is possible to wrap any types here, only wrapped InterpolationFunctions will make this type be an InterpolationFunction.

Traits implemented

A wrapper around a Interpolation-Function that fixes the argument

Note that while it is possible to wrap any types here, only wrapped InterpolationFunctions will make this type be an InterpolationFunction and only wrapped DurationCalculables will make this type be an DurationCalculable.

The fixed argument

The interpolator

Traits implemented

Linear interpolation

Will interpolate linearly from from to to

Traits implemented

Triangle interpolation

Will interpolate linearly from from to to in the first half and then back from to to from in the second half. This will always cycle back to the initial value.

Traits implemented