Skip to content

Instantly share code, notes, and snippets.

@cp-hardik-p
Created May 30, 2022 11:26
Show Gist options
  • Save cp-hardik-p/98c86e32c16cc6b6ba942e14159ffca9 to your computer and use it in GitHub Desktop.
Save cp-hardik-p/98c86e32c16cc6b6ba942e14159ffca9 to your computer and use it in GitHub Desktop.
@Composable
fun ExclamationEmoji(infiniteTransition: InfiniteTransition) {
val eyeAnimation by infiniteTransition.animateFloat(
initialValue = 1f,
targetValue = 30f,
animationSpec = infiniteRepeatable(
animation = tween(1500, easing = FastOutSlowInEasing),
repeatMode = RepeatMode.Reverse
)
)
Canvas(
modifier = Modifier
.padding(top = 40.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 = eyeAnimation,
)
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 = eyeAnimation,
)
drawCircle(
color = Color.Black,
center = Offset(x = 65.dp.toPx(), y = 30.dp.toPx()),
radius = 10f,
)
drawCircle(
color = ExclamationEmojiColor,
center = Offset(x = 50.dp.toPx(), y = 70.dp.toPx()),
radius = 20f,
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment