Skip to content

Instantly share code, notes, and snippets.

@Kpeved
Created February 23, 2023 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kpeved/f57e5028a88452a99bd7957fcdf9b127 to your computer and use it in GitHub Desktop.
Save Kpeved/f57e5028a88452a99bd7957fcdf9b127 to your computer and use it in GitHub Desktop.
// 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