ColorBuilders.SweepGradient.Builder


class ColorBuilders.SweepGradient.Builder


Builder for SweepGradient.

Summary

Public constructors

@RequiresSchemaVersion(major = 1, minor = 300)
@SafeVarargs
Builder(colorStops: Array<ColorBuilders.ColorStop!>)

Creates an instance of Builder.

@RequiresSchemaVersion(major = 1, minor = 300)
@SafeVarargs
Builder(colors: Array<ColorBuilders.ColorProp!>)

Creates an instance of Builder.

Public functions

ColorBuilders.SweepGradient

Builds an instance from accumulated values.

ColorBuilders.SweepGradient.Builder
@RequiresSchemaVersion(major = 1, minor = 300)
setEndAngle(endAngle: DimensionBuilders.DegreesProp)

Sets the end angle of the gradient, relative to the element's base angle.

ColorBuilders.SweepGradient.Builder
@RequiresSchemaVersion(major = 1, minor = 300)
setStartAngle(startAngle: DimensionBuilders.DegreesProp)

Sets the start angle of the gradient relative to the element's base angle.

Public constructors

Builder

@RequiresSchemaVersion(major = 1, minor = 300)
@SafeVarargs
Builder(colorStops: Array<ColorBuilders.ColorStop!>)

Creates an instance of Builder.

Parameters
colorStops: Array<ColorBuilders.ColorStop!>

The color stops defining how the colors are distributed around the gradient center.

A color stop is composed 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.

Throws
java.lang.IllegalArgumentException

if the number of colors is less than 2 or larger than 10.

Builder

@RequiresSchemaVersion(major = 1, minor = 300)
@SafeVarargs
Builder(colors: Array<ColorBuilders.ColorProp!>)

Creates an instance of Builder.

The colors are evenly distributed in the gradient.

Parameters
colors: Array<ColorBuilders.ColorProp!>

The color sequence to be distributed around the gradient center. The color sequence is distributed between the gradient's start and end angles.

Throws
java.lang.IllegalArgumentException

if the number of colors is less than 2 or larger than 10.

Public functions

build

Added in 1.1.0
fun build(): ColorBuilders.SweepGradient

Builds an instance from accumulated values.

Throws
java.lang.IllegalStateException

if size of colorStops is less than 2 or greater than 10.

setEndAngle

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun setEndAngle(endAngle: DimensionBuilders.DegreesProp): ColorBuilders.SweepGradient.Builder

Sets 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, 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.

Note that this field only supports static values.

setStartAngle

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun setStartAngle(startAngle: DimensionBuilders.DegreesProp): ColorBuilders.SweepGradient.Builder

Sets 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, 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.

Note that this field only supports static values.