+ val indicatorIndex by animateFloatAsState(selectedIndex.toFloat(), animSpec)
- val indicatorIndex = remember { Animatable(0f) }
- val targetIndicatorIndex = selectedIndex.toFloat()
- LaunchedEffect(targetIndicatorIndex) {
- indicatorIndex.animateTo(targetIndicatorIndex, animSpec)
- }
d
Doris Liu
02/04/2021, 2:23 AM
animateFloatAsState
uses the first
targetValue
that was passed to it as its initial value. But sometimes you may want to have a different initial value (usually as an enter transition) and animate from there to the first target value, in which case you need