Concepts

Functions

The Function interface represents a mathematical function. Its purpose is to associate a floating value to any input floating value between 0f and 1f. This function specifies the rate of change of a parameter over time (for example the position of an object).

The library provides a set of functions among the most common ones. Each one contains a convenient instance. For example the singleton for the linear function.

Simple functions

The constant function represents a constant motion whose value is always the stop value.

../../../_images/constant.svg

The linear function represents a uniform linear motion: the velocity is constant (no acceleration or deceleration).

../../../_images/linear.svg

Easing functions

The easing functions come in 3 forms:

  • Ease-in: the function is eased at the beginning.

  • Ease-out: the function is eased at the end.

  • Ease-in-out: the function is eased at the beginning and the end.

Here are the easing functions available in the library:

Circ ease-in

../../../_images/circ-ease-in.svg

Circ ease-out

../../../_images/circ-ease-out.svg

Circ ease-in-out

../../../_images/circ-ease-in-out.svg

Cubic ease-in

../../../_images/cubic-ease-in.svg

Cubic ease-out

../../../_images/cubic-ease-out.svg

Cubic ease-in-out

../../../_images/cubic-ease-in-out.svg

Expo ease-in

../../../_images/expo-ease-in.svg

Expo ease-out

../../../_images/expo-ease-out.svg

Expo ease-in-out

../../../_images/expo-ease-in-out.svg

Quad ease-in

../../../_images/quad-ease-in.svg

Quad ease-out

../../../_images/quad-ease-out.svg

Quad ease-in-out

../../../_images/quad-ease-in-out.svg

Quart ease-in

../../../_images/quart-ease-in.svg

Quart ease-out

../../../_images/quart-ease-out.svg

Quart ease-in-out

../../../_images/quart-ease-in-out.svg

Quint ease-in

../../../_images/quint-ease-in.svg

Quint ease-out

../../../_images/quint-ease-out.svg

Quint ease-in-out

../../../_images/quint-ease-in-out.svg

Sine ease-in

../../../_images/sine-ease-in.svg

Sine ease-out

../../../_images/sine-ease-out.svg

Sine ease-in-out

../../../_images/sine-ease-in-out.svg

Back ease-in

../../../_images/back-ease-in.svg

Back ease-out

../../../_images/back-ease-out.svg

Back ease-in-out

../../../_images/back-ease-in-out.svg

Bounce ease-in

../../../_images/bounce-ease-in.svg

Bounce ease-out

../../../_images/bounce-ease-out.svg

Bounce ease-in-out

../../../_images/bounce-ease-in-out.svg

Elastic ease-in

../../../_images/elastic-ease-in.svg

Elastic ease-out

../../../_images/elastic-ease-out.svg

Elastic ease-in-out

../../../_images/elastic-ease-in-out.svg

Custom Function

It is possible to create custom functions by creating a class implementing the Function interface. The computeValue(float) method should return a value between 0f and 1f.

Motion

The Motion class is used to describe the movement of an element. It is made of a function, a start value, a stop value and a duration.

It proposes a convenient method Motion.getValue(long) to retrieve the position of the element at the specified elapsed time.