got a working solution by invalidating the composa...
# compose
s
got a working solution by invalidating the composable indefinitely within a loop. here's the code but it's very hacky, i suspect there are better ways to do this so we'll wait for some experts to chime in
Copy code
@Composable
fun Confetti() {
    var invalidate by remember { mutableStateOf(false) }
    val handler = Handler(Looper.getMainLooper())
    val runnable = object : Runnable {
        override fun run() {
            invalidate = !invalidate
            handler.postDelayed(this, 16)
        }
    }

    WithConstraints {
        AndroidView(
            { KonfettiView(it) },
            modifier = Modifier.fillMaxSize().offset(if (invalidate) 0.dp else 0.01.dp)
        ) {
            it.build()
                .addColors(Color.YELLOW, Color.GREEN, Color.RED)
                .setFadeOutEnabled(true)
                .setTimeToLive(2000L)
                .addShapes(Square, Circle)
                .setPosition(-50f, constraints.maxWidth + 50f, -50f, -50f)
                .streamFor(particlesPerSecond = 150, emittingTime = StreamEmitter.INDEFINITE)
        }
    }
    onActive {
        <http://handler.post|handler.post>(runnable)
    }
}