public class KeyframesSpecConfig<T> : KeyframesSpecBaseConfig<T, KeyframeEntity<T>>()
KeyframesSpecConfig stores a mutable configuration of the key frames, including durationMillis, delayMillis, and all the key frames. Each key frame defines what the animation value should be at a particular time. Once the key frames are fully configured, the KeyframesSpecConfig can be used to create a KeyframesSpec.
Functions
createEntityFor
override fun createEntityFor(value: T): KeyframeEntity<T>
at
override infix fun T.at(@IntRange(from = 0) timeStamp: Int): KeyframeEntity<T>
Adds a keyframe so that animation value will be this at time: timeStamp. For example: 0.8f at 150 // ms
Parameters
| timeStamp | The time in the during when animation should reach value: this, with a minimum value of 0. |
Return
an KeyframeEntity so a custom Easing can be added by with method.
atFraction
override infix fun T.atFraction(
@FloatRange(from = 0.0, to = 1.0) fraction: Float
): KeyframeEntity<T>
Adds a keyframe so that the animation value will be the value specified at a fraction of the total durationMillis set. For example: 0.8f atFraction 0.50f // half of the overall duration set
Parameters
| fraction | The fraction when the animation should reach specified value. |
Return
an KeyframeEntity so a custom Easing can be added by with method
with
@Deprecated(
message =
"Use version that returns an instance of the entity so it can be re-used" +
" in other keyframe builders.",
replaceWith = ReplaceWith("this using easing"), // Expected usage pattern
)
public infix fun KeyframeEntity<T>.with(easing: Easing)
Adds an Easing for the interval started with the just provided timestamp. For example: 0f at 50 with LinearEasing
Parameters
| easing | Easing to be used for the next interval. |
Return
the same KeyframeEntity instance so that other implementations can expand on the builder pattern
using
public infix fun KeyframeEntity<T>.using(arcMode: ArcMode): KeyframeEntity<T>
ArcMode applied from this keyframe to the next.
Note that arc modes are meant for objects with even dimensions (such as Offset and its variants). Where each value pair is animated as an arc. So, if the object has odd dimensions the last value will always animate linearly.
The order of each value in an object with multiple dimensions is given by the applied vector converter in KeyframesSpec.vectorize.
E.g.: RectToVector assigns its values as `left, top, right, bottom so the pairs of dimensions animated as arcs are: left, top and right, bottom`.