# ColorBuilders.SweepGradient

# ColorBuilders.SweepGradient

Artifact:[androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout)  
[View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/ColorBuilders.java+class:androidx.wear.protolayout.ColorBuilders.SweepGradient)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/protolayout/ColorBuilders.SweepGradient "View this page in Java")

<br />

```
@RequiresSchemaVersion(major = 1, minor = 300)
class ColorBuilders.SweepGradient : ColorBuilders.Brush
```

<br />

*** ** * ** ***

A sweep gradient with the given colors dispersed around its center with offsets defined in each color stop. The sweep begins at the parent's base angle plus the given angular shift and continues clockwise until it reaches the starting position again.

The gradient center corresponds to center of the parent element.

## Summary

|                                                                                                                                       ### Nested types                                                                                                                                        |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[ColorBuilders.SweepGradient.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.SweepGradient.Builder) Builder for[SweepGradient](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.SweepGradient). |

|                                                                                                                                                         ### Public functions                                                                                                                                                          |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[ColorBuilders.ColorStop](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.ColorStop)`!>` | [getColorStops](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.SweepGradient#getColorStops())`()` Gets the color stops defining how the colors are distributed around the gradient center. |
| [DimensionBuilders.DegreesProp](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/DimensionBuilders.DegreesProp)                                                                                                                                                                                               | [getEndAngle](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.SweepGradient#getEndAngle())`()` Gets the end angle of the gradient, relative to the element's base angle.                    |
| [DimensionBuilders.DegreesProp](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/DimensionBuilders.DegreesProp)                                                                                                                                                                                               | [getStartAngle](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.SweepGradient#getStartAngle())`()` Gets the start angle of the gradient relative to the element's base angle.               |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                                                                                                                                                                     | [toString](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.SweepGradient#toString())`()`                                                                                                    |

## Public functions

### getColorStops

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.1.0)  

```
fun getColorStops(): (Mutable)List<ColorBuilders.ColorStop!>
```

Gets the color stops defining how the colors are distributed around the gradient center. The color sequence starts at the start angle and spans 360 degrees clockwise, finishing at the same angle.

A color stop is a pair of a color and its offset in the gradient. The offset is the relative position of the color, beginning with 0 from the start angle and ending with 1.0 at the end angle, spanning clockwise.

There must be at least 2 colors and at most 10 colors.

If offset values are not set, the colors are evenly distributed in the gradient.  

### getEndAngle

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.1.0)  

```
fun getEndAngle(): DimensionBuilders.DegreesProp
```

Gets the end angle of the gradient, relative to the element's base angle. If not set, defaults to 360 degrees.

For[androidx.wear.protolayout.LayoutElementBuilders.ArcLine](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/LayoutElementBuilders.ArcLine), the base angle is the angle where the line starts. The value represents a relative position in the line's length span. Values greater than 360 degrees correspond to upper layers of the arc line as it wraps over itself.  

### getStartAngle

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.1.0)  

```
fun getStartAngle(): DimensionBuilders.DegreesProp
```

Gets the start angle of the gradient relative to the element's base angle. If not set, defaults to zero.

For[androidx.wear.protolayout.LayoutElementBuilders.ArcLine](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/LayoutElementBuilders.ArcLine), the base angle is the angle where the line starts. The value represents a relative position in the line's length span. Values greater than 360 degrees correspond to upper layers of the arc line as it wraps over itself.  

### toString

```
fun toString(): String
```