Function

sweepGradient

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

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free

sweepGradient

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

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:

 Brush.sweepGradient(    0.0.rf to Color.Red.rc,    0.3.rf to Color.Green.rc,    1.0.rf to Color.Blue.rc,    center = Offset(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

sweepGradient

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

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:

 Brush.sweepGradient(    listOf(Color.Red.rc, Color.Blue.rc),    center = Offset(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