Last active
December 7, 2020 19:05
-
-
Save surajsau/1260526a3b2d2903ac871850d675dc64 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
@Composable | |
fun Slot( | |
from: Int, | |
to: Int, | |
modifier: Modifier = Modifier, | |
) { | |
SlotText( | |
state = transition( | |
definition = transitionDefinition { | |
// [1] | |
state(0) { this[currentSlotValue] = from.toFloat() } | |
state(1) { this[currentSlotValue] = to.toFloat() } | |
transition(0 to 1) { | |
// [2] | |
currentSlotValue using tween( | |
durationMillis = abs(to - from) * 3_00, | |
easing = LinearEasing | |
) | |
} | |
}, | |
initState = 0, | |
toState = 1, | |
), | |
modifier = modifier | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment