Skip to content

Repository files navigation

ComposeCarouselLib

A Jetpack Compose carousel with pluggable page effects — Tinder deck swipe, water ripple, cover flow, page curl, and ~20 more. Swap effects at runtime, or write your own.

Requirements

minSdk = 33 (shader effects use AGSL RuntimeShader).

Install

Add JitPack to your root settings.gradle:

dependencyResolutionManagement {
repositories {
maven { url = uri("https://jitpack.io") }
}
}

Then depend on the library:

dependencies {
implementation("com.github.Ali0092:ComposeCarouselSlider:2.0.1")
}

Usage

val images =listOf(
CarouselImage.Resource(R.drawable.image1),
CarouselImage.Url("https://example.com/image2.jpg"),
)
CarouselSlider(
items = images,
effect =TinderEffect(),
onItemClick = { index ->/* ... */ },
)

That's the whole API. Change effect = ... to switch styles; everything else has a sensible default.

Effects

Pass any of these classes to the effect parameter — e.g. effect = WaterRippleEffect().

Shader-based (fancy)

  • WaterRippleEffect()
  • PageCurlEffect()
  • MorphEffect()
  • GlitchEffect()
  • ChromaticAberrationEffect()
  • NoiseDissolveEffect()
  • PixelateEffect()
  • MotionBlurEffect()

3D / card-deck

  • TinderEffect()
  • CoverFlowEffect()
  • Cube3DEffect()
  • StackEffect()
  • Flip3DEffect()
  • BookFoldEffect()
  • FanEffect()

Everyday

  • AccordionEffect()
  • ElasticEffect()
  • RotateEffect()
  • ParallaxEffect()
  • DepthEffect()
  • ZoomOutEffect()
  • FadeEffect()
  • ScaleEffect()
  • NoEffect (default — pages just slide)

Or grab them all at once: CarouselEffects.all (curated order), CarouselEffects.fancy, CarouselEffects.geometry3d, CarouselEffects.common.

Roll your own by implementing CarouselEffect and overriding buildItemModifier (or rememberItemModifier if you need state).

Parameters

NameDefaultWhat it does
itemsrequiredList<CarouselImage> (Resource, Url, ImageBitmap, or Painter)
showBackgroundImagetrueBlurred full-bleed backdrop of the current image
backgroundBlurRadius40.dpBlur strength for the backdrop
pageHeightnullFixed card height; null fills parent
contentPadding32.dp horizontalPadding around the pager
pageSpacing8.dpSpace between pages
itemCornerRadius20.dpCorner radius on the image card
effectNoEffectThe page transform
autoScrollfalseAuto-advance through pages
autoScrollDelayMs3000Delay between auto-scrolls
autoScrollAnimationSpecspring()Auto-scroll animation
pagerStaterememberedProvide one to control the pager externally
onItemClicknullCalled with the tapped page index

Preview

compose_carousel_library.mp4

License

Apache 2.0 — see LICENSE.

Author

Muhammad Ali

EmailPortfolioLinkedInGitHub

❤️ Created with love by Muhammad Ali

About

A lightweight and customizable image carousel slider

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages