Composable Function

carouselParallaxScrollEffect

Add a parallax effect to an item by clipping and translating the item as it enters and exits a scrollable viewport.

carouselParallaxScrollEffect

Source set: Common
@Composable
public fun Modifier.carouselParallaxScrollEffect(
    index: Int,
    state: CarouselParallaxScrollEffectState,
    shape: Shape,
    border: BorderStroke? = null,
): Modifier

Add a parallax effect to an item by clipping and translating the item as it enters and exits a scrollable viewport.

Use carouselParallaxScrollEffect to give any scrollable container the look and feel of a Material uncontained multi-aspect carousel. Unlike dedicated Carousel composables (i.e. HorizontalMultiBrowseCarousel, HorizontalCenteredHeroCarousel) which are based on Pager and require all items to be the same size, this modifier can be used with androidx.compose.foundation.lazy.LazyRow, androidx.compose.foundation.lazy.LazyColumn, androidx.compose.foundation.lazy.grid.LazyHorizontalGrid, androidx.compose.foundation.lazy.grid.LazyVerticalGrid, or any custom scrollable where items are able to vary in size.

Parameters

index the index of the item this modifier is applied to
state the object holding the scrollable container's effect state
shape the shape to clip the item and optional border to
border an optional border to draw around the clipped shape

Content updated: