Created
February 23, 2023 21:09
-
-
Save Kpeved/7a4f88abb1f08814c6e7b2aaa19301a3 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
// 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