rememberAnchoredDraggableState

fun <T : Any> rememberAnchoredDraggableState(any: Any, initialValue: T, anchors: DraggableAnchors<T>, animationSpec: AnimationSpec<Float> = spring(), positionalThreshold: (distance: Float) -> Float = { it * 0.5f }, velocityThreshold: () -> Float = { 10f }, confirmValueChange: (T) -> Boolean = { true }): AnchoredDraggableState<T>

Parameters

initialValue

初始值

animationSpec

动画spec

positionalThreshold

位置阈值,到哪里放手之后就会自动执行动画

velocityThreshold

速度阈值,当速度到达每秒/px的时候就会执行动画,就算位置阈值还没达到

confirmValueChange

根据完成时的值决定是否执行动画,如果是false,那么将复原