SnowfallStyle

data class SnowfallStyle(val density: Float = 0.35f, val colors: List<Color> = listOf(Color.White), val minSize: Dp = 2.dp, val maxSize: Dp = 7.dp, val speed: Float = 1.0f, val wind: Float = 0.0f, val minAlpha: Float = 0.45f, val maxAlpha: Float = 0.95f, val shape: SnowflakeShape = SnowflakeShape.Mixed, val maxFlakes: Int = 160)(source)

Appearance and motion of snowfall.

Constructors

Link copied to clipboard
constructor(density: Float = 0.35f, colors: List<Color> = listOf(Color.White), minSize: Dp = 2.dp, maxSize: Dp = 7.dp, speed: Float = 1.0f, wind: Float = 0.0f, minAlpha: Float = 0.45f, maxAlpha: Float = 0.95f, shape: SnowflakeShape = SnowflakeShape.Mixed, maxFlakes: Int = 160)

Properties

Link copied to clipboard

Flake colors, picked at random per flake. Choose colors that stand apart from the surface behind them: white flakes disappear on a light theme.

Link copied to clipboard

How much snow falls, from 0 (none) to 1 (a blizzard). The flake count scales with the drawn area, so a phone and a tablet at the same density look equally snowy.

Link copied to clipboard

Opacity of the most visible flakes.

Link copied to clipboard

Hard cap on the flake count, which bounds the per-frame cost on large or very dense surfaces.

Link copied to clipboard
val maxSize: Dp

Largest flake diameter. Larger flakes also fall faster, so size doubles as depth.

Link copied to clipboard

Opacity of the faintest flakes.

Link copied to clipboard
val minSize: Dp

Smallest flake diameter.

Link copied to clipboard

How the flakes are drawn.

Link copied to clipboard

Fall speed multiplier. 1 is a gentle drift; values above 2 look like a storm.

Link copied to clipboard
val wind: Float

Constant horizontal drift from -1 (strong wind to the left) to 1 (to the right).