Created
February 23, 2023 21:43
-
-
Save Kpeved/f57e5028a88452a99bd7957fcdf9b127 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
// Assume that duration is 1/12th of the whole duration, which equals to the length of 2 hours. It can be longer or shorter if necessary | |
val disassembleDuration = duration / 12 | |
LaunchedEffect(currentHourFlow) { | |
currentHourFlow.collectLatest { | |
// launch each animation asynchronously | |
launch { | |
if (currentHour < 12) { | |
disassembleAnimations[currentHour].snapTo(0f) | |
// Set a tween spec with LinearOutSlowIn easing | |
disassembleAnimations[currentHour].animateTo( | |
1f, | |
tween(disassembleDuration, easing = LinearOutSlowInEasing) | |
) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment