Function

sweepGradient

Creates a sweep gradient with the given colors dispersed around the center with offsets defined in each colorstop pair.

sweepGradient

Source set: JvmAndAndroid
public fun RemoteBrush.Companion.sweepGradient(
    vararg colorStops: Pair<RemoteFloat, RemoteColor>,
    center: RemoteOffset? = null,
): RemoteShaderBrush

Creates a sweep gradient with the given colors dispersed around the center with offsets defined in each colorstop pair. The sweep begins relative to 3 o'clock and continues clockwise until it reaches the starting position again.

Ex:

RemoteBrush.sweepGradient(
0.0f.rf to Color.Red.rc,
0.3f.rf to Color.Green.rc,
1.0f.rf to Color.Blue.rc,
center = RemoteOffset(0.rf, 100.rf)
)

Parameters

colorStops Colors and offsets to determine how the colors are dispersed throughout the sweep gradient
center Center position of the sweep gradient circle. If this is set to null then the center of the drawing area is used as the center for the sweep gradient

Return

a RemoteShaderBrush that draws a sweep gradient with the given colorStops

sweepGradient

Source set: JvmAndAndroid
public fun RemoteBrush.Companion.sweepGradient(
    colors: List<RemoteColor>,
    center: RemoteOffset? = null,
): RemoteShaderBrush

Creates a sweep gradient with the given colors dispersed evenly around the center. The sweep begins relative to 3 o'clock and continues clockwise until it reaches the starting position again.

Ex:

RemoteBrush.sweepGradient(
listOf(Color.Red.rc, Color.Blue.rc),
center = RemoteOffset(10.rf, 20.rf)
)

Parameters

colors List of colors to fill the sweep gradient
center Center position of the sweep gradient circle. If this is null then the center of the drawing area is used as the center for the sweep gradient

Return

a RemoteShaderBrush that draws a sweep gradient across the given colors

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: