Roller animation effect with Compose
RollerNumberAnimator(
startValue = 1990,
endValue = 2022
)
RollerNumberAnimator(
startValue = 2022,
endValue = 1990,
decrease = true
)
- 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 = {}
)