Created
June 10, 2022 07:37
-
-
Save raipankaj/4a83eef5874500a4c2b94ed8dee019af to your computer and use it in GitHub Desktop.
Mirror effect Jetpack Compose
This file contains 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 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