androidx.compose.material3

animateFloatingActionButtonSince 1.10

Function

No hand-written docs yet.

Apply this modifier to a FloatingActionButton to show or hide it with an animation, typically based on the app's main content scrolling.

Parameters

fun Modifier.animateFloatingActionButton(
    visible: Boolean,
    alignment: Alignment,
    targetScale: Float = FloatingActionButtonDefaults.ShowHideTargetScale,
    scaleAnimationSpec: AnimationSpec<Float>? = null,
    alphaAnimationSpec: AnimationSpec<Float>? = null,
): Modifier

visible: BooleanRequired

whether the FAB should be shown or hidden with an animation

alignment: AlignmentRequired

the direction towards which the FAB should be scaled to and from

targetScale: FloatOptional

Default: FloatingActionButtonDefaults.ShowHideTargetScale

the initial scale value when showing the FAB and the final scale value when hiding the FAB

scaleAnimationSpec: AnimationSpec<Float>?Optional

Default: null

the AnimationSpec to use for the scale part of the animation, if null the Fast Spatial spring spec from the MotionScheme will be used

alphaAnimationSpec: AnimationSpec<Float>?Optional

Default: null

the AnimationSpec to use for the alpha part of the animation, if null the Fast Effects spring spec from the MotionScheme will be used

Library docs

Apply this modifier to a FloatingActionButton to show or hide it with an animation, typically based on the app's main content scrolling.