Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Created November 12, 2021 19:08
Show Gist options
  • Select an option

  • Save EmmanuelGuther/6246819a2734446c74dec031e7641df5 to your computer and use it in GitHub Desktop.

Select an option

Save EmmanuelGuther/6246819a2734446c74dec031e7641df5 to your computer and use it in GitHub Desktop.
Jetpack compose alpha background animated
@Composable
fun BackgroundAlphaAnimated() {
val animatedAlpha = remember { Animatable(0f) }
Box(
Modifier
.background(color = (Color.DarkGray.copy(alpha = animatedAlpha.value)))
.fillMaxSize()
)
LaunchedEffect(animatedAlpha) {
animatedAlpha.animateTo(
targetValue = 1f,
animationSpec = infiniteRepeatable(tween(4000), RepeatMode.Reverse)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment