verticalGradient
Source set: JvmAndAndroid
public fun RemoteBrush.Companion.verticalGradient(
colors: List<RemoteColor>,
startY: RemoteFloat? = null,
endY: RemoteFloat? = null,
tileMode: RemoteTileMode = RemoteTileMode.Clamp,
): RemoteShaderBrush
Creates a vertical gradient with the given colors evenly dispersed within the gradient Ex:
RemoteBrush.verticalGradient(
listOf(Color.Red.rc, Color.Green.rc, Color.Blue.rc),
startY = 0.rf,
endY = 100.rf
)
Parameters
| colors | colors to be rendered as part of the gradient |
| startY | Starting y position of the vertical gradient. Defaults to 0 which represents the top of the drawing area |
| endY | Ending y position of the vertical gradient. Defaults to Float.POSITIVE_INFINITY which indicates the bottom of the specified drawing area |
| tileMode | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to RemoteTileMode.Clamp to repeat the edge pixels |
Return
a RemoteShaderBrush that draws a vertical gradient across the given colors
verticalGradient
Source set: JvmAndAndroid
public fun RemoteBrush.Companion.verticalGradient(
vararg colorStops: Pair<RemoteFloat, RemoteColor>,
startY: RemoteFloat? = null,
endY: RemoteFloat? = null,
tileMode: RemoteTileMode = RemoteTileMode.Clamp,
): RemoteShaderBrush
Creates a vertical gradient with the given colors at the provided offset defined in the Pair<RemoteFloat, RemoteColor>
Ex:
RemoteBrush.verticalGradient(
0.1f.rf to Color.Red.rc,
0.3f.rf to Color.Green.rc,
0.5f.rf to Color.Blue.rc,
startY = 0.0f.rf,
endY = 100.0f.rf
)
Parameters
| colorStops | Colors and offsets to determine how the colors are dispersed throughout the vertical gradient |
| startY | Starting y position of the vertical gradient. Defaults to 0 which represents the top of the drawing area |
| endY | Ending y position of the vertical gradient. Defaults to Float.POSITIVE_INFINITY which indicates the bottom of the specified drawing area |
| tileMode | Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to RemoteTileMode.Clamp to repeat the edge pixels |
Return
a RemoteShaderBrush that draws a vertical gradient with the given colorStops