kyrie / com.github.alexjlockwood.kyrie / Keyframe

Keyframe

class Keyframe<T>

This class holds a time/value pair for an animation. A Keyframe is used to define the values that the animation target will have over the course of the animation. As the time proceeds from one keyframe to the other, the value of the target will animate between the value at the previous keyframe and the value at the next keyframe. Each keyframe also holds an optional TimeInterpolator object, which defines the time interpolation over the inter-value preceding the keyframe.

Parameters

T - The keyframe value type.

Properties

fraction

var fraction: Float

Gets the time for this Keyframe, as a fraction of the overall animation duration.

interpolator

var interpolator: TimeInterpolator?

Gets the optional interpolator for this Keyframe. A value of null indicates that there is no interpolation, which is the same as linear interpolation.

value

var value: T?

Gets the value for this Keyframe.

Functions

fraction

fun fraction(fraction: Float): Keyframe<T>

Sets the time for this Keyframe, as a fraction of the overall animation duration.

interpolator

fun interpolator(interpolator: TimeInterpolator?): Keyframe<T>

Sets the optional interpolator for this Keyframe. A value of null indicates that there is no interpolation, which is the same as linear interpolation.

value

fun value(value: T?): Keyframe<T>

Sets the value for this Keyframe.

Companion Object Functions

of

fun <T> of(fraction: Float): Keyframe<T>

Constructs a Keyframe object with the given time. The value at this time will be derived from the target object when the animation first starts. The time defines the time, as a proportion of an overall animation's duration, at which the value will hold true for the animation. The value for the animation between keyframes will be calculated as an interpolation between the values at those keyframes.

fun <T> of(fraction: Float, value: T?): Keyframe<T>

Constructs a Keyframe object with the given time and value. The time defines the time, as a proportion of an overall animation's duration, at which the value will hold true for the animation. The value for the animation between keyframes will be calculated as an interpolation between the values at those keyframes.