I want to create an infinite animation with a one-time start delay
in Jetpack Compose
.
I used infiniteRepeatable()
with tween()
:
val value by rememberInfiniteTransition().animateFloat(
initialValue = 0f,
targetValue = 1f,
animationSpec = infiniteRepeatable(
animation = tween(
durationMillis = 700,
delayMillis = 200
)
)
)
in this case, the delayMillis
will repeat:
*delay* 0..1, *delay* 0..1, *delay* 0..1 , *delay* 0..1 ...
but in ValueAnimator
the start delay
is one-time delay:
val animator = ValueAnimator.ofFloat(0f, 1f).apply {
duration = 700
startDelay = 200
repeatCount = ValueAnimator.INFINITE
addListener { /* value */ }
}
animator.start()
*delay* 0..1, 0..1, 0..1, 0..1, 0..1, 0..1, 0..1 ...
Is there any way to set a one-time start delay for InfiniteRepeatable
in Jetpack Compose
?
Thanks