我有一个圆形进度条(健身跟踪器),我想动画的“进度”与弹簧动画使用阻尼和刚度。不是普通的动画。
发布于 2021-08-07 20:14:31
您可以使用和应用ProgressIndicatorDefaults.ProgressAnimationSpec动画来编写jetpack。
var progress by remember { mutableStateOf(0.0f) }
val animatedProgress by animateFloatAsState(
targetValue = progress,
animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec
)
CircularProgressIndicator(progress = animatedProgress)最后,分配progress值。
否则,您可以使用自定义animationSpec,如:
val customProgressAnimationSpec = SpringSpec(
dampingRatio = 1f,
stiffness = 50f,
visibilityThreshold = 1 / 1000f
)

https://stackoverflow.com/questions/68695412
复制相似问题