androidx.ui.foundation.animation

Classes

AnimatedValueHolder

Value holder that allows to animate value that it holds.

FlingConfig

Class to specify fling behavior.

Top-level functions summary

FlingConfig
AnchorsFlingConfig(anchors: List<Float>, animationBuilder: AnimationBuilder<Float> = PhysicsBuilder(), onAnimationEnd: OnFlingEnd? = null, decayAnimation: DecayAnimation = ExponentialDecay())

Create fling config with anchors will make sure that after drag has ended, the value will be animated to one of the points from the predefined list.

Effect<AnimatedValueHolder>
animatedDragValue(initial: Float, minBound: Float, maxBound: Float)

Effect to construct and memorize value holder

Extension functions summary

For AnimatedFloat
Unit
AnimatedFloat.fling(config: FlingConfig, startVelocity: Float)

Starts a fling animation with the specified starting velocity and fling configuration.

Top-level functions

AnchorsFlingConfig

fun AnchorsFlingConfig(
    anchors: List<Float>,
    animationBuilder: AnimationBuilder<Float> = PhysicsBuilder(),
    onAnimationEnd: OnFlingEnd? = null,
    decayAnimation: DecayAnimation = ExponentialDecay()
): FlingConfig

Create fling config with anchors will make sure that after drag has ended, the value will be animated to one of the points from the predefined list.

It takes velocity into account, though value will be animated to the closest point in provided list considering velocity.

Parameters
anchors: List<Float> set of anchors to animate to
onAnimationEnd: OnFlingEnd? = null callback to be invoked when animation value reaches desired anchor or fling being interrupted by gesture input. Consult AnimationEndReason param to know what happened.
animationBuilder: AnimationBuilder<Float> = PhysicsBuilder() animation which will be used for animations
decayAnimation: DecayAnimation = ExponentialDecay() decay animation to be used to calculate closest point in the anchors set considering velocity.

animatedDragValue

@CheckResult("+") fun animatedDragValue(
    initial: Float,
    minBound: Float,
    maxBound: Float
): Effect<AnimatedValueHolder>

Effect to construct and memorize value holder

This effects sets initial value inside this holder to initial, and can rewrite min and max bound without reconstructing the whole holder if they change.

Parameters
initial: Float initial value to put inside the value holder
minBound: Float minimal bound for the value inside the holder
maxBound: Float maximal bound for the value inside the holder

Extension functions

fling

fun AnimatedFloat.fling(
    config: FlingConfig,
    startVelocity: Float
): Unit

Starts a fling animation with the specified starting velocity and fling configuration.

Parameters
config: FlingConfig configuration that specifies fling behaviour
startVelocity: Float Starting velocity of the fling animation