Thanks Oleksandr, I completed my solution. I didn'...
# compose-android
k
Thanks Oleksandr, I completed my solution. I didn't use like modifier. I draw inside the canvas. Can you please look on this solution and any improvements needed?
Copy code
Preview(showBackground = true)
@Composable
fun PulseAnimation() {
    Box(
        contentAlignment = Alignment.Center,
        modifier = Modifier.fillMaxSize()
    ) {
        val transition = rememberInfiniteTransition()
        val duration = 3_000
        val count = 3
        val progress = List(3) {
            transition.animateFloat(
                initialValue = 0f,
                targetValue = 1f,
                animationSpec = InfiniteRepeatableSpec(
                    animation = tween(durationMillis = duration, easing = LinearEasing),
                    initialStartOffset = StartOffset(it * duration / count),
                    repeatMode = RepeatMode.Restart,
                )
            )
        }
        Canvas(modifier = Modifier.fillMaxHeight()) {
            val radius = 40.dp.toPx() / 2f
            drawLine(
                color = Color.Black,
                start = Offset(x = size.width / 2, y = 0F),
                end = Offset(x = size.width / 2, y = size.height / 2),
                strokeWidth = 2.dp.toPx(),
            )
            progress.forEach {
                drawCircle(
                    color = Color.Magenta.copy(alpha = 1f - it.value),
                    radius = radius * it.value,
                    center = Offset(size.width, size.height / 2)
                )
            }
        }
    }
}