multiBrowseFlingBehavior

@Composable
fun multiBrowseFlingBehavior(state: CarouselState, decayAnimationSpec: DecayAnimationSpec<Float> = rememberSplineBasedDecay(), snapAnimationSpec: AnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow)): TargetedFlingBehavior

A TargetedFlingBehavior that flings and snaps according to the gesture velocity. snapAnimationSpec and decayAnimationSpec can be used to control the animation specs.

The Carousel may use decayAnimationSpec or snapAnimationSpec to approach the target item post-scroll, depending on the gesture velocity. If the gesture has a high enough velocity to approach the target item, the Carousel will use decayAnimationSpec followed by snapAnimationSpec for the final step of the animation. If the gesture doesn't have enough velocity, it will use snapAnimationSpec + snapAnimationSpec in a similar fashion.

Return

An instance of TargetedFlingBehavior that performs flinging based on the gesture velocity and then snapping to the closest item post-fling. The animation will be governed by the post scroll velocity and the Carousel will use snapAnimationSpec to approach the snapped position

Parameters

state

The CarouselState that controls which Carousel this TargetedFlingBehavior will be applied to.

decayAnimationSpec

The animation spec used to approach the target offset when the the fling velocity is large enough to naturally decay.

snapAnimationSpec

The animation spec used to finally snap to the position.