animateInteractionScaleAsState

@Composable
fun animateInteractionScaleAsState(targetScale: Float, pressed: Boolean, focused: Boolean, hovered: Boolean, label: String = "interaction-scale", visibilityThreshold: Float = 0.01f, finishedListener: (Float) -> Unit? = null, animationSpecProvider: (pressed: Boolean, focused: Boolean, hovered: Boolean) -> AnimationSpec<Float> = { press, focus, hover -> defaultScaleAnimationSpec(pressed = press, focused = focus, hovered = hover) }): State<Float>

Fire-and-forget animation function for Float. Using animateFloatAsState on the provided targetScale updating based on the current Interaction provided on the interactionSource.

animateInteractionScaleAsState returns a State object. The value of the state object will continuously be updated by the animation until the animation finishes.

Return

A State object, the value of which is updated by animation.

Since

0.2.0

Parameters

targetScale

Target value of the animation.

animationSpecProvider

The animation to provide based on the current Interaction that will be used to change the value through time.

visibilityThreshold

An optional threshold for deciding when the animation value is considered close enough to the targetScale.

label

An optional label to differentiate from other animations in Android Studio.

finishedListener

An optional end listener to get notified when the animation is finished.