Skip to content

Instantly share code, notes, and snippets.

@raipankaj
Created June 10, 2022 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raipankaj/4a83eef5874500a4c2b94ed8dee019af to your computer and use it in GitHub Desktop.
Save raipankaj/4a83eef5874500a4c2b94ed8dee019af to your computer and use it in GitHub Desktop.
Mirror effect Jetpack Compose
@Composable
fun Mirror(content: @Composable () -> Unit) {
Column {
content()
Box(modifier = Modifier
.graphicsLayer {
alpha = 0.99f
rotationZ = 180f
}
.drawWithContent {
val colors = listOf(Color.Transparent, Color.White)
drawContent()
drawRect(brush = Brush.verticalGradient(colors),
blendMode = BlendMode.DstIn)
}
.blur(radiusX = 1.dp, radiusY = 3.dp, BlurredEdgeTreatment.Unbounded)
.clip(
HalfSizeShape
)
) {
content()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment