Skip to content

Instantly share code, notes, and snippets.

@Kpeved
Created March 12, 2023 21:57
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/3f47e605aebfe471950c608444e57160 to your computer and use it in GitHub Desktop.
Save Kpeved/3f47e605aebfe471950c608444e57160 to your computer and use it in GitHub Desktop.
...
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
val size = 300.dp
var progress by remember { mutableStateOf(0f) }
var animationAngle by remember { mutableStateOf(0f) }
Box(
modifier = Modifier
.size(size)
.background(Color.Black)
) {
ClockAnimation(animationAngle)
}
Text("Control animation with a slider!")
Slider(
modifier = Modifier.padding(16.dp),
value = progress,
onValueChange = {
progress = it
animationAngle = it * 720f
}
)
} ...
}
@Composable
fun ClockAnimation(animationAngle: Float) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment