Created
December 7, 2020 16:36
-
-
Save surajsau/e1e93ea1dd9b6bcf84e74da0fd34d05f to your computer and use it in GitHub Desktop.
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 CircleNeomorph( | |
state: TransitionState, | |
modifier: Modifier = Modifier, | |
) { | |
// [1] | |
val bias = (3 - 2f * state[buttonStateProgress]) * 0.1f | |
Box(modifier = modifier.size(size = 200.dp)) { | |
// [2] | |
Box(modifier = Modifier.size(120.dp) | |
.clip(shape = CircleShape) | |
.background( | |
brush = RadialGradient( | |
colors = listOf(NeomorphLightColor, Color.Transparent), | |
.. | |
) | |
) | |
// [3] | |
.align(alignment = BiasAlignment(-bias, -bias)) | |
) | |
// [4] | |
Box(modifier = Modifier.size(120.dp) | |
.clip(shape = CircleShape) | |
.background( | |
brush = RadialGradient( | |
colors = listOf(NeomorphDarkColor, Color.Transparent), | |
.. | |
) | |
) | |
// [5] | |
.align(alignment = BiasAlignment(bias, bias)) | |
) | |
// [6] | |
Box(modifier = Modifier.size(size = 100.dp) | |
.clip(shape = CircleShape) | |
.align(alignment = Alignment.Center) | |
.background(color = NeomorphColor)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment