TwoWayConverter


TwoWayConverter class contains the definition on how to convert from an arbitrary type T to a AnimationVector, and convert the AnimationVector back to the type T. This allows animations to run on any type of objects, e.g. position, rectangle, color, etc.

Summary

Public properties

(V) -> T

Defines how to convert a Vector type (i.e. AnimationVector1D, AnimationVector2D, AnimationVector3D or AnimationVector4D, depends on the dimensions of type T) back to type T.

Cmn
(T) -> V

Defines how a type T should be converted to a Vector type (i.e. AnimationVector1D, AnimationVector2D, AnimationVector3D or AnimationVector4D, depends on the dimensions of type T).

Cmn

Extension functions

V
<T : Any?, V : AnimationVector> TwoWayConverter<T, V>.createZeroVectorFrom(
    value: T
)

Creates an AnimationVector with all the values set to 0 using the provided TwoWayConverter and the value.

Cmn

Public properties

convertFromVector

val convertFromVector: (V) -> T

Defines how to convert a Vector type (i.e. AnimationVector1D, AnimationVector2D, AnimationVector3D or AnimationVector4D, depends on the dimensions of type T) back to type T.

convertToVector

val convertToVector: (T) -> V

Defines how a type T should be converted to a Vector type (i.e. AnimationVector1D, AnimationVector2D, AnimationVector3D or AnimationVector4D, depends on the dimensions of type T).

Extension functions

createZeroVectorFrom

fun <T : Any?, V : AnimationVector> TwoWayConverter<T, V>.createZeroVectorFrom(
    value: T
): V

Creates an AnimationVector with all the values set to 0 using the provided TwoWayConverter and the value.

Returns
V

a new AnimationVector instance of type V.