RainfallStyle

data class RainfallStyle(val density: Float = 0.4f, val colors: List<Color> = listOf(Color(0xFFB3C7DD)), val minLength: Dp = 10.dp, val maxLength: Dp = 22.dp, val thickness: Dp = 1.5.dp, val speed: Float = 1.0f, val wind: Float = 0.15f, val gusts: Float = 0.5f, val showers: Float = 0.35f, val splashes: Boolean = true, val splashSize: Dp = 7.dp, val minAlpha: Float = 0.25f, val maxAlpha: Float = 0.6f, val maxDrops: Int = 180)(source)

Appearance and motion of rainfall.

Constructors

Link copied to clipboard
constructor(density: Float = 0.4f, colors: List<Color> = listOf(Color(0xFFB3C7DD)), minLength: Dp = 10.dp, maxLength: Dp = 22.dp, thickness: Dp = 1.5.dp, speed: Float = 1.0f, wind: Float = 0.15f, gusts: Float = 0.5f, showers: Float = 0.35f, splashes: Boolean = true, splashSize: Dp = 7.dp, minAlpha: Float = 0.25f, maxAlpha: Float = 0.6f, maxDrops: Int = 180)

Properties

Link copied to clipboard

Drop colors, picked at random per drop. Choose colors that stand apart from the surface behind them.

Link copied to clipboard

How much rain falls, from 0 (none) to 1 (a downpour). The drop count scales with the drawn area, so a phone and a tablet at the same density look equally wet.

Link copied to clipboard

How much the wind swings around wind, from 0 (steady) to 1 (stormy).

Link copied to clipboard

Opacity of the most visible drops.

Link copied to clipboard

Hard cap on the drop count, which bounds the per-frame cost.

Link copied to clipboard

Longest streak. Longer streaks also fall faster, so length doubles as depth.

Link copied to clipboard

Opacity of the faintest drops.

Link copied to clipboard

Shortest streak.

Link copied to clipboard

How much the rain comes and goes, from 0 (steady) to 1 (dropping to nothing between showers).

Link copied to clipboard

Fall speed multiplier. 1 is steady rain.

Link copied to clipboard

Whether landing drops leave a widening ring.

Link copied to clipboard

How wide the splash of a drop at middle depth grows.

Link copied to clipboard

Stroke width of a streak at middle depth. Near streaks are drawn thicker, far ones thinner.

Link copied to clipboard
val wind: Float

Slant and drift from -1 (blown to the left) to 1 (to the right).