Skip to content

Instantly share code, notes, and snippets.

@surajsau
Created December 7, 2020 16:36
Show Gist options
  • Save surajsau/e1e93ea1dd9b6bcf84e74da0fd34d05f to your computer and use it in GitHub Desktop.
Save surajsau/e1e93ea1dd9b6bcf84e74da0fd34d05f to your computer and use it in GitHub Desktop.
@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