Skip to content

chinalwb/compose-roller-animator

Repository files navigation

ComposeRollerAnimator

Roller animation effect with Compose

Looks like:

Sample code:

RollerNumberAnimator(
    startValue = 1990,
    endValue = 2022
)

Decrease and reverse:

Sample code:

RollerNumberAnimator(
    startValue = 2022,
    endValue = 1990,
    decrease = true
)

Simple Demo

simple_demo

API and parmas:

  • Simple, check it out as blow:
  • Params are pretty self explanatory.
fun RollerNumberAnimator(
    modifier: Modifier = Modifier,
    startValue: Int,
    endValue: Int,
    animateOneByOne: Boolean = false,
    ltr: Boolean = false,
    decrease: Boolean = false,
    duration: Int? = null,
    animateToSameNumber: Boolean = false,
    useFading: Boolean = true,
    vPadding: Dp = 4f.dp,
    textSize: TextUnit = 36.sp,
    textColor: Color = Color(0xFFFEFEFE),
    backgroundColor: Color = Color(0xFF0CCD8C),
    onLayoutFinished: (paddingBottomDp: Dp) -> Unit = {},
    onRollingFinished: (endValue: Int) -> Unit = {}
)

Just another demo

Screen_Recording_20220612-191227_My.Application.mp4

Releases

No releases published

Packages

No packages published

Languages