Google is committed to advancing racial equity for Black communities. See how.

FlingConfig

@Immutable data class FlingConfig
kotlin.Any
   ↳ androidx.compose.foundation.animation.FlingConfig

Class to specify fling behavior.

When drag has ended, this class specifies what to do given the velocity with which drag ended and AnimatedFloat instance to perform fling on and read current value.

Config that provides natural fling with customizable behaviour e.g fling friction or result target adjustment.

If you want to only be able to drag/animate between predefined set of values, consider using FlingConfig function with anchors to generate such behaviour.

Summary

Public constructors
<init>(decayAnimation: FloatDecayAnimationSpec, adjustTarget: (Float) -> TargetAnimation? = { null })

Class to specify fling behavior.

Properties
(Float) -> TargetAnimation?

callback to be called at the start of fling so the final value for fling can be adjusted

FloatDecayAnimationSpec

the animation to control fling behaviour

Public constructors

<init>

FlingConfig(
    decayAnimation: FloatDecayAnimationSpec,
    adjustTarget: (Float) -> TargetAnimation? = { null })

Class to specify fling behavior.

When drag has ended, this class specifies what to do given the velocity with which drag ended and AnimatedFloat instance to perform fling on and read current value.

Config that provides natural fling with customizable behaviour e.g fling friction or result target adjustment.

If you want to only be able to drag/animate between predefined set of values, consider using FlingConfig function with anchors to generate such behaviour.

Parameters
decayAnimation: FloatDecayAnimationSpec the animation to control fling behaviour
adjustTarget: (Float) -> TargetAnimation? = { null } callback to be called at the start of fling so the final value for fling can be adjusted

Properties

adjustTarget

val adjustTarget: (Float) -> TargetAnimation?

callback to be called at the start of fling so the final value for fling can be adjusted

decayAnimation

val decayAnimation: FloatDecayAnimationSpec

the animation to control fling behaviour