Untitled
Anonymous
kotlin
10/17/2022 1:18 PM
844 B
18
Indexable
val colors = listOf(Color.Red, Color.Gray, Color.Yellow, Color.Cyan)
var count by remember { mutableStateOf(0) }
val activeColor by animateColorAsState(targetValue = colors[count])
LaunchedEffect(key1 = Unit) {
while (true) {
delay(1000)
count = if (count == 3) 0 else count + 1
}
}
Surface(
modifier = Modifier.fillMaxSize(),
color = activeColor
) {
}Editor is loading...