snowfall

fun Modifier.snowfall(style: SnowfallStyle = SnowfallStyle(), enabled: Boolean = true): Modifier(source)

Draws falling snow over this element's content.

The snow is drawn after the content, so it sits on top of it, and it takes no input: taps go through to whatever is underneath. Apply it last in a chain to cover everything the element draws.

Only the draw phase runs per frame. Nothing recomposes or re-measures while snow falls, and the frame loop follows the composition's frame clock, so it stops while the window is in the background. Callers that honour the system's animation setting should pass enabled = false when it is off (see Context.isSystemAnimationDisabled).

Box(Modifier.fillMaxSize().snowfall(SnowfallStyle(density = 0.5f, wind = 0.2f)))

Parameters

style

Appearance and motion of the flakes.

enabled

When false nothing is drawn and no frames are requested.