horizontalGradient

fun horizontalGradient(vararg colorStops: Pair<Float, ColorSchema>, startX: Int = 0, endX: Int? = null, tileMode: TileModeSchema = TileModeSchema.CLAMP, alpha: Float = 1.0f): BackgroundSchema.HorizontalGradient

Horizontal gradient background running from startX to endX, with explicit color stops. Dimensions are in dp; endX left null means the tile's right edge.

Parameters

colorStops

Explicit stop to color pairs, e.g. 0f to color(...).

startX

Starting x position, in dp. Defaults to 0.

endX

Ending x position, in dp. Defaults to none (the tile's right edge).

tileMode

How the gradient repeats past its endX when it doesn't cover the whole tile. Defaults to clamp (extends the last color).

alpha

Opacity applied to the whole gradient, from 0f to 1f. Defaults to 1f.


fun horizontalGradient(colors: List<ColorSchema>, startX: Int = 0, endX: Int? = null, tileMode: TileModeSchema = TileModeSchema.CLAMP, alpha: Float = 1.0f): BackgroundSchema.HorizontalGradient

Horizontal gradient background running from startX to endX, with colors spread evenly along the line. Dimensions are in dp; endX left null means the tile's right edge.

Parameters

colors

Colors spread evenly along the gradient.

startX

Starting x position, in dp. Defaults to 0.

endX

Ending x position, in dp. Defaults to none (the tile's right edge).

tileMode

How the gradient repeats past its endX when it doesn't cover the whole tile. Defaults to clamp (extends the last color).

alpha

Opacity applied to the whole gradient, from 0f to 1f. Defaults to 1f.