Function

radialGradient

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

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free

radialGradient

Android
public fun RemoteBrush.Companion.radialGradient(
    vararg colorStops: Pair<RemoteFloat, RemoteColor>,
    center: RemoteOffset? = null,
    radius: RemoteFloat? = null,
    tileMode: ComposeTileMode = ComposeTileMode.Clamp,
): RemoteBrush

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

Brush.radialGradient(    0.0f to Color.Red.rc,    0.3f to Color.Green.rc,    1.0f to Color.Blue.rc,    center = Offset(side1 / 2.0f, side2 / 2.0f),    radius = side1 / 2.0f,    tileMode = TileMode.Repeated
)

Parameters

colorStops Colors and offsets to determine how the colors are dispersed throughout the radial gradient
center Center position of the radial gradient circle. If this is set to Offset.Unspecified then the center of the drawing area is used as the center for the radial gradient. Float.POSITIVE_INFINITY can be used for either Offset.x or Offset.y to indicate the far right or far bottom of the drawing area respectively.
radius Radius for the radial gradient. Defaults to positive infinity to indicate the largest radius that can fit within the bounds of the drawing area
tileMode Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to ComposeTileMode.Clamp to repeat the edge pixels

radialGradient

Android
public fun RemoteBrush.Companion.radialGradient(
    colors: List<RemoteColor>,
    center: RemoteOffset? = null,
    radius: RemoteFloat? = null,
    tileMode: ComposeTileMode = ComposeTileMode.Clamp,
): RemoteBrush

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

Brush.radialGradient(    listOf(Color.Red.rc, Color.Blue.rc),    center = Offset(side1 / 2.0f, side2 / 2.0f),    radius = side1 / 2.0f,    tileMode = TileMode.Repeated
)

Parameters

colors Colors to be rendered as part of the gradient
center Center position of the radial gradient circle. If this is set to Offset.Unspecified then the center of the drawing area is used as the center for the radial gradient. Float.POSITIVE_INFINITY can be used for either Offset.x or Offset.y to indicate the far right or far bottom of the drawing area respectively.
radius Radius for the radial gradient. Defaults to positive infinity to indicate the largest radius that can fit within the bounds of the drawing area
tileMode Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to ComposeTileMode.Clamp to repeat the edge pixels