Untitled

 avatar
unknown
kotlin
2 years ago
631 B
8
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...