Skip to content

Instantly share code, notes, and snippets.

@Kpeved
Created February 23, 2023 21:09
Show Gist options
  • Save Kpeved/7a4f88abb1f08814c6e7b2aaa19301a3 to your computer and use it in GitHub Desktop.
Save Kpeved/7a4f88abb1f08814c6e7b2aaa19301a3 to your computer and use it in GitHub Desktop.
// Remove derivedStateOf
var currentHour by remember { mutableStateOf(0) }
LaunchedEffect(animationAngle) {
// Add hour calculation inside of a launchEffect
val newCurrentHour = animationAngle.toInt() / 30
if (newCurrentHour != currentHour) {
currentHour = newCurrentHour
// Sending currentHour through channel
currentHourChannel.trySend(currentHour)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment