Skip to content

Instantly share code, notes, and snippets.

@cp-hardik-p
Last active May 31, 2022 09:01
Show Gist options
  • Save cp-hardik-p/37b56b26904220650a2b065ad8ac37ec to your computer and use it in GitHub Desktop.
Save cp-hardik-p/37b56b26904220650a2b065ad8ac37ec to your computer and use it in GitHub Desktop.
@Composable
fun HappyEmoji() {
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 = 30f,
)
drawCircle(
color = Color.Black,
center = Offset(x = 65.dp.toPx(), y = 30.dp.toPx()),
radius = 10f,
)
val mouthPath = Path().let {
it.moveTo(size * 0.22.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 * 0.95.dp.toPx(),
size * 0.22.dp.toPx(), size * 0.70.dp.toPx()
)
it.close()
it
}
drawPath(path = mouthPath, color = Color.Black)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment