<div class='type'>Compose Modifier</div>

<a id='references'></a>


<h2 id="animatefloatingactionbutton-visible-alignment-targetscale-scaleanimationspec-alphaanimationspec">animateFloatingActionButton</h2>

<div class='sourceset sourceset-common'>Common</div>


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


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

#### Parameters

| | |
| --- | --- |
| visible | whether the FAB should be shown or hidden with an animation |
| alignment | the direction towards which the FAB should be scaled to and from |
| targetScale | the initial scale value when showing the FAB and the final scale value when hiding the FAB |
| scaleAnimationSpec | 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 | the `AnimationSpec` to use for the alpha part of the animation, if null the Fast Effects spring spec from the `MotionScheme` will be used |