Source set: Common
@Deprecated(
message =
"Use the progress function to query the progress between two specified " + "anchors.",
replaceWith = ReplaceWith("progress(state.settledValue, state.targetValue)"),
)
public val progress: Float by
derivedStateOf(structuralEqualityPolicy()) {
val a = anchors.positionOf(settledValue)
val b = anchors.positionOf(targetValue)
val distance = abs(b - a)
if (!distance.isNaN() && distance > 1e-6f) {
val progress = (this.requireOffset() - a) / (b - a)
// If we are very close to 0f or 1f, we round to the closest
if (progress < 1e-6f) 0f else if (progress > 1 - 1e-6f) 1f else progress
} else 1f
}
The fraction of the progress going from settledValue to targetValue, within 0f..1f bounds, or 1f if the AnchoredDraggableState is in a settled state.