Created
April 23, 2021 16:22
-
-
Save Oleur/9a4bcf1c4fffbfc847d54125ea52ba4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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