Created
April 23, 2021 16:27
-
-
Save Oleur/128a36288cbe42c08f3b56c0a3aa8e07 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 PolygonImageComposable(modifier: Modifier) { | |
val deltaXAnim = rememberInfiniteTransition() | |
val dx by deltaXAnim.animateFloat( | |
initialValue = 3f, | |
targetValue = 10f, | |
animationSpec = infiniteRepeatable( | |
animation = tween(4000, easing = LinearEasing), | |
repeatMode = RepeatMode.Reverse | |
) | |
) | |
CoilImage( | |
data = "myAwesomeImage.jpg", | |
contentDescription = "Awesome Image", | |
contentScale = ContentScale.Crop, | |
modifier = modifier | |
.size(width = 300.dp, height = 200.dp) | |
.graphicsLayer { | |
shadowElevation = 4.dp.toPx() | |
shape = PolyShape(dx.toInt(), 100.dp.toPx()) | |
clip = true | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment