horizontalGradient

fun horizontalGradient(vararg colors: Int): DynamicShader

Creates a DynamicShader in the form of a horizontal gradient.

Parameters

colors

the sRGB colors to be distributed along the gradient line.


fun horizontalGradient(colors: IntArray, positions: FloatArray? = null): DynamicShader

Creates a DynamicShader in the form of a horizontal gradient.

Parameters

colors

the sRGB colors to be distributed along the gradient line.

positions

controls the position of each color on the gradient line. Each element of the array should belong to the interval [0, 1], where 0 corresponds to the start of the gradient line, and 1 corresponds to the end of the gradient line. If null (the default value) is passed, the colors will be distributed evenly along the gradient line.