RepeatableSpec
-
Cmn
class RepeatableSpec<T : Any?> : FiniteAnimationSpec
RepeatableSpec takes another DurationBasedAnimationSpec and plays it iterations times. For creating infinitely repeating animation spec, consider using InfiniteRepeatableSpec.
Note: When repeating in the RepeatMode.Reverse mode, it's highly recommended to have an odd number of iterations. Otherwise, the animation may jump to the end value when it finishes the last iteration.
initialStartOffset can be used to either delay the start of the animation or to fast forward the animation to a given play time. This start offset will not be repeated, whereas the delay in the animation (if any) will be repeated. By default, the amount of offset is 0.
Summary
Public constructors |
|
|---|---|
<T : Any?> RepeatableSpec( |
Cmn
|
Public functions |
||
|---|---|---|
open operator Boolean |
Cmn
|
|
open Int |
hashCode() |
Cmn
|
open VectorizedFiniteAnimationSpec<V> |
<V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>)Creates a |
Cmn
|
Public properties |
||
|---|---|---|
DurationBasedAnimationSpec<T> |
the |
Cmn
|
StartOffset |
offsets the start of the animation |
Cmn
|
Int |
the count of iterations. |
Cmn
|
RepeatMode |
whether animation should repeat by starting from the beginning (i.e. |
Cmn
|
Public constructors
RepeatableSpec
<T : Any?> RepeatableSpec(
iterations: Int,
animation: DurationBasedAnimationSpec<T>,
repeatMode: RepeatMode = RepeatMode.Restart,
initialStartOffset: StartOffset = StartOffset(0)
)
| Parameters | |
|---|---|
iterations: Int |
the count of iterations. Should be at least 1. |
animation: DurationBasedAnimationSpec<T> |
the |
repeatMode: RepeatMode = RepeatMode.Restart |
whether animation should repeat by starting from the beginning (i.e. |
initialStartOffset: StartOffset = StartOffset(0) |
offsets the start of the animation |
Public functions
vectorize
open fun <V : AnimationVector> vectorize(converter: TwoWayConverter<T, V>): VectorizedFiniteAnimationSpec<V>
Creates a VectorizedAnimationSpec with the given TwoWayConverter.
The underlying animation system operates on AnimationVectors. T will be converted to AnimationVector to animate. VectorizedAnimationSpec describes how the converted AnimationVector should be animated. E.g. The animation could simply interpolate between the start and end values (i.e.TweenSpec), or apply spring physics to produce the motion (i.e. SpringSpec), etc)
| Parameters | |
|---|---|
converter: TwoWayConverter<T, V> |
converts the type |
Public properties
repeatMode
val repeatMode: RepeatMode
whether animation should repeat by starting from the beginning (i.e. RepeatMode.Restart) or from the end (i.e. RepeatMode.Reverse)