Skip to content

Instantly share code, notes, and snippets.

@Oleur
Created April 23, 2021 16:27
Show Gist options
  • Save Oleur/128a36288cbe42c08f3b56c0a3aa8e07 to your computer and use it in GitHub Desktop.
Save Oleur/128a36288cbe42c08f3b56c0a3aa8e07 to your computer and use it in GitHub Desktop.
@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