Is there a way to add delay to spring animation sp...
# compose
k
Is there a way to add delay to spring animation spec?
v
Just call
delay
before starting animation
k
interesting, how I would go about that? I have state
animateFloatAsState
, which target value is driven by other bool property
a
You can do something like this:
Copy code
val targetValue = if (anotherProperty) 1f else 0f
val float = remember { Animatable(targetValue) }
LaunchedEffect(targetValue) {
    delay(1000)
    float.animateTo(targetValue)
}
d
Curious what your use case is. 🙂
k
@Doris Liu No biggie, just wanted to wait for spring animation to fire later then as soon as property changes @Albert Chang thanks, used
LaunchedEffect
to achieve this 👍