Last active
December 7, 2020 19:08
-
-
Save surajsau/36fae9cdfef6ab342bfb07e74af9a3a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val currentSlotValue = FloatPropKey() | |
@Composable | |
fun SlotText( | |
state: TransitionState, | |
modifier: Modifier = Modifier | |
) { | |
// [1] | |
var current = state[currentSlotValue].toInt() | |
// [2] | |
val delta = state[currentSlotValue] - state[currentSlotValue].toInt() | |
// [3] | |
val yOffset = (delta * 50).dp | |
Box(modifier = ..clipToBounds()) { | |
// [4] | |
Text( | |
text = "$current", | |
.. | |
modifier = Modifier.offset(y = 0.dp - yOffset) | |
) | |
// [5] | |
Text( | |
text = "${(current + 1)%10}", | |
.. | |
modifier = Modifier.offset(y = 50.dp - yOffset) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment