I'm creating a custom Progress UI component that animates the progress using animateFloatAsState
like so:
@Composable
fun CustomProgressBar(progressValue: Float = 0f) {
val animatedProgress by
animateFloatAsState(
targetValue = progressValue,
animationSpec = TweenSpec(durationMillis = 500, easing = LinearEasing))
LinearProgressIndicator(progress = animatedProgress)
}
How can I ensure someone using this component doesn't update the progressValue
so often that the animation will look janky?
Can this be throttled within the Composable? Or should this be the responsibility of the caller?