I have a circular progress bar(fitness tracker) I want to animate the "progress" with spring animation using damping and stiffness. Not the normal animation.
I have a circular progress bar(fitness tracker) I want to animate the "progress" with spring animation using damping and stiffness. Not the normal animation.
You can use jetpack compose using a CircularProgressIndicator and applying a ProgressIndicatorDefaults.ProgressAnimationSpec animation.
var progress by remember { mutableStateOf(0.0f) }
val animatedProgress by animateFloatAsState(
targetValue = progress,
animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec
)
CircularProgressIndicator(progress = animatedProgress)
Finally assign the progress value.
Otherwise you can use a custom animationSpec like:
val customProgressAnimationSpec = SpringSpec(
dampingRatio = 1f,
stiffness = 50f,
visibilityThreshold = 1 / 1000f
)