Last active
May 31, 2022 09:05
-
-
Save cp-hardik-p/0ab86669d7e2e80d344f7f3f7a11a077 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 CoolEmoji() { | |
val size = 100 | |
Canvas( | |
modifier = Modifier | |
.padding(top = 16.dp) | |
.size(size.dp) | |
) { | |
drawArc( | |
color = Color(0xFFFFd301), | |
startAngle = 0f, | |
sweepAngle = 360f, | |
useCenter = true | |
) | |
drawCircle( | |
color = Color.White, | |
center = Offset(x = 35.dp.toPx(), y = 30.dp.toPx()), | |
radius = 30f, | |
) | |
drawCircle( | |
color = Color.Black, | |
center = Offset(x = 35.dp.toPx(), y = 30.dp.toPx()), | |
radius = 10f, | |
) | |
drawCircle( | |
color = Color.White, | |
center = Offset(x = 65.dp.toPx(), y = 30.dp.toPx()), | |
radius = 20f, | |
) | |
drawCircle( | |
color = Color.Black, | |
center = Offset(x = 65.dp.toPx(), y = 30.dp.toPx()), | |
radius = 10f, | |
) | |
val mouthPath = Path().let { | |
it.moveTo(size * 0.20.dp.toPx(), size * 0.70.dp.toPx()) | |
it.quadraticBezierTo( | |
size * 0.50.dp.toPx(), size * 0.80.dp.toPx(), | |
size * 0.78.dp.toPx(), size * 0.70.dp.toPx() | |
) | |
it.quadraticBezierTo( | |
size * 0.50.dp.toPx(), size * 1.60.dp.toPx(), | |
size * 0.20.dp.toPx(), size * 0.70.dp.toPx() | |
) | |
it.close() | |
it | |
} | |
drawPath(path = mouthPath, color = TongueColor) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment