FlingConfig

data class FlingConfig
kotlin.Any
   ↳ androidx.ui.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.

The most common Decay animation is ExponentialDecay.

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

Summary

Public constructors

<init>(decayAnimation: DecayAnimation = ExponentialDecay(), onAnimationEnd: OnFlingEnd? = null, 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

DecayAnimation

the animation to control fling behaviour

OnFlingEnd?

callback to be invoked when fling finishes by decay or being interrupted by gesture input.

Public constructors

<init>

FlingConfig(
    decayAnimation: DecayAnimation = ExponentialDecay(),
    onAnimationEnd: OnFlingEnd? = null,
    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.

The most common Decay animation is ExponentialDecay.

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

Parameters
decayAnimation: DecayAnimation = ExponentialDecay() the animation to control fling behaviour
onAnimationEnd: OnFlingEnd? = null callback to be invoked when fling finishes by decay or being interrupted by gesture input. Consider second boolean param "cancelled" to know what happened.
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: DecayAnimation

the animation to control fling behaviour

onAnimationEnd

val onAnimationEnd: OnFlingEnd?

callback to be invoked when fling finishes by decay or being interrupted by gesture input. Consider second boolean param "cancelled" to know what happened.