androidx.dynamicanimation.animation


Interfaces

DynamicAnimation.OnAnimationEndListener

An animation listener that receives end notifications from an animation.

DynamicAnimation.OnAnimationUpdateListener

Implementors of this interface can add themselves as update listeners to an DynamicAnimation instance to receive callbacks on every animation frame, after the current frame's values have been calculated for that DynamicAnimation.

Classes

DynamicAnimation

This class is the base class of physics-based animations.

DynamicAnimation.ViewProperty

ViewProperty holds the access of a property of a View.

FlingAnimation

Fling animation is an animation that continues an initial momentum (most often from gesture velocity) and gradually slows down.

FloatPropertyCompat

FloatPropertyCompat is an abstraction that can be used to represent a mutable float value that is held in a host object.

FloatValueHolder

FloatValueHolder holds a float value.

SpringAnimation

SpringAnimation is an animation that is driven by a SpringForce.

SpringForce

Spring Force defines the characteristics of the spring being used in the animation.

Top-level functions summary

FlingAnimation
flingAnimationOf(setter: (Float) -> Unit, getter: () -> Float)

Creates FlingAnimation for a property that can be accessed via the provided setter and getter.

SpringAnimation
springAnimationOf(
    setter: (Float) -> Unit,
    getter: () -> Float,
    finalPosition: Float
)

Creates SpringAnimation for a property that can be accessed via the provided setter and getter.

Extension functions summary

inline SpringAnimation

Updates or applies spring force properties like SpringForce.mDampingRatio, SpringForce.mFinalPosition and stiffness on SpringAnimation.

Top-level functions

fun flingAnimationOf(setter: (Float) -> Unit, getter: () -> Float): FlingAnimation

Creates FlingAnimation for a property that can be accessed via the provided setter and getter. For example, the following sample code creates a FlingAnimation for the alpha property of a View object named view: flingAnimationOf(view::setAlpha, view::getAlpha)

Parameters
setter: (Float) -> Unit

The function that mutates the property being animated

getter: () -> Float

The function that returns the value of the property

fun springAnimationOf(
    setter: (Float) -> Unit,
    getter: () -> Float,
    finalPosition: Float = Float.NaN
): SpringAnimation

Creates SpringAnimation for a property that can be accessed via the provided setter and getter. If finalPosition is not Float.NaN then create SpringAnimation with SpringForce.mFinalPosition.

Parameters
setter: (Float) -> Unit

The function that mutates the property being animated

getter: () -> Float

The function that returns the value of the property

finalPosition: Float = Float.NaN

SpringForce.mFinalPosition Final position of spring.

Extension functions

withSpringForceProperties

inline fun SpringAnimation.withSpringForceProperties(func: SpringForce.() -> Unit): SpringAnimation

Updates or applies spring force properties like SpringForce.mDampingRatio, SpringForce.mFinalPosition and stiffness on SpringAnimation.

If SpringAnimation.mSpring is null in case SpringAnimation is created without final position it will be created and attached to SpringAnimation

Parameters
func: SpringForce.() -> Unit

lambda with receiver on SpringForce