Skip to content

Instantly share code, notes, and snippets.

@Oleur
Created April 23, 2021 16:22
Show Gist options
  • Save Oleur/9a4bcf1c4fffbfc847d54125ea52ba4f to your computer and use it in GitHub Desktop.
Save Oleur/9a4bcf1c4fffbfc847d54125ea52ba4f to your computer and use it in GitHub Desktop.
@Composable
fun TicketWaveComposable(modifier: Modifier) {
val deltaXAnim = rememberInfiniteTransition()
val dx by deltaXAnim.animateFloat(
initialValue = 0f,
targetValue = 1f,
animationSpec = infiniteRepeatable(animation = tween(500, easing = LinearEasing))
)
CoilImage(
data = "myAwesomeImage.jpg",
contentDescription = "Awesome Image",
contentScale = ContentScale.Crop,
modifier = modifier
.size(width = 300.dp, height = 200.dp)
.graphicsLayer {
val animDx = dx
shadowElevation = 0.dp.toPx()
shape = GenericShape { size: Size, _: LayoutDirection ->
wavePath(size, animDx, 50.dp.toPx())
}
clip = true
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment