Function

horizontalGradient

Creates a horizontal gradient with the given colors evenly dispersed within the gradient Ex: `` RemoteBrush.horizontalGradient( listOf(Color.Red.rc, Color.Green.rc, Color.Blue.rc), startX = 10.rf, endX = 20.rf ) ``

horizontalGradient

Source set: JvmAndAndroid
public fun RemoteBrush.Companion.horizontalGradient(
    colors: List<RemoteColor>,
    startX: RemoteFloat? = null,
    endX: RemoteFloat? = null,
    tileMode: RemoteTileMode = RemoteTileMode.Clamp,
): RemoteShaderBrush

Creates a horizontal gradient with the given colors evenly dispersed within the gradient

Ex:

RemoteBrush.horizontalGradient(
listOf(Color.Red.rc, Color.Green.rc, Color.Blue.rc),
startX = 10.rf,
endX = 20.rf
)

Parameters

colors colors to be rendered as part of the gradient
startX Starting x position of the horizontal gradient. Defaults to 0 which represents the left of the drawing area
endX Ending x position of the horizontal gradient. Defaults to Float.POSITIVE_INFINITY which indicates the right 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 horizontal gradient across the given colors

horizontalGradient

Source set: JvmAndAndroid
public fun RemoteBrush.Companion.horizontalGradient(
    vararg colorStops: Pair<RemoteFloat, RemoteColor>,
    startX: RemoteFloat? = null,
    endX: RemoteFloat? = null,
    tileMode: RemoteTileMode = RemoteTileMode.Clamp,
): RemoteShaderBrush

Creates a horizontal gradient with the given colors dispersed at the provided offset defined in the colorstop pair.

Ex:

RemoteBrush.horizontalGradient(
0.rf to Color.Red.rc,
0.3f.rf to Color.Green.rc,
1.rf to Color.Blue.rc,
startX = 0.rf,
endX = 100.rf
)

Parameters

colorStops Colors and offsets to determine how the colors are dispersed throughout the vertical gradient
startX Starting x position of the horizontal gradient. Defaults to 0 which represents the left of the drawing area
endX Ending x position of the horizontal gradient. Defaults to Float.POSITIVE_INFINITY which indicates the right 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 horizontal gradient with the given colorStops

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: