Skip to content

Instantly share code, notes, and snippets.

@cp-hardik-p
Created May 30, 2022 07:00
Show Gist options
  • Save cp-hardik-p/97b370333fe13c2585368418a46cc1c3 to your computer and use it in GitHub Desktop.
Save cp-hardik-p/97b370333fe13c2585368418a46cc1c3 to your computer and use it in GitHub Desktop.
@Composable
fun ConfusedEmoji() {
val easing = LinearOutSlowInEasing
val offsetX by animateValues(
values = listOf(0f, 15f, -15f, 0f),
animationSpec = infiniteRepeatable(
animation = tween(durationMillis = 1500, easing = easing),
repeatMode = RepeatMode.Restart
)
)
Canvas(
modifier = Modifier
.padding(top = 16.dp)
.size(100.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(-offsetX + 35.dp.toPx(), 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(-offsetX + 65.dp.toPx(), 30.dp.toPx()),
radius = 10f,
)
drawLine(
start = Offset(x = 30.dp.toPx(), y = 70.dp.toPx()),
end = Offset(x = 70.dp.toPx(), y = 70.dp.toPx()),
color = Color.Black,
strokeWidth = 10.0f
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment