Gradients.ToGradient

Extension Method in Gradients

Declaration

public static Gradient ToGradient(this GradientColorKey[] colors, GradientAlphaKey[] alpha)

Description

Creates a new gradient and sets the given color keys and alpha keys.

Parameters

colorsThe color keys to set on the gradient.
alphaThe alpha keys to set on the gradient.

Returns

GradientThe new gradient.

Overload

Declaration

public static Gradient ToGradient(this GradientColorKey[] colors, float alpha = 1F)

Description

Creates a new gradient and sets the given color keys with a constant alpha value for the entire gradient.

Parameters

colorsThe color keys to set on the gradient.
alphaThe alpha value to set for the entire gradient [0..1] (default=1).

Returns

GradientThe new gradient.

Overload

Declaration

public static Gradient ToGradient(this Color start, Color end)

Description

Creates a new gradient with a given start color and end color.

Parameters

startThe start color of the gradient.
endThe end color of the gradient.

Returns

GradientThe new gradient.

Overload

Declaration

public static Gradient ToGradient(this Color start, Color end, int stops)

Description

Creates a new gradient that interpolates a linear amount of stops between a start color and end color.

Parameters

startThe start color of the gradient.
endThe end color of the gradient.
stopsThe amount of stops to interpolate between the start and end color.

Returns

GradientThe new gradient.

Overload

Declaration

public static Gradient ToGradient(this Color start, Color end, float[] stops)

Description

Creates a new gradient that distributes a predefined array of stops between a start color and end color.

Parameters

startThe start color of the gradient.
endThe end color of the gradient.
stopsThe array of stops to distribute between the start and end color.

Returns

GradientThe new gradient.

Overload

Declaration

public static Gradient ToGradient(this Color start, params Color[] stops)

Description

Creates a new gradient with the given colors evenly distributed throughout.

Parameters

startThe start color of the gradient.
stopsThe remaining colors of the gradient.

Returns

GradientThe new gradient.

Overload

Declaration

public static Gradient ToGradient(this Color[] colors)

Description

Creates a new gradient with the given colors evenly distributed throughout.

Parameters

colorsThe colors of the gradient.

Returns

GradientThe new gradient.

Overload

Declaration

public static Gradient ToGradient(this Color[] colors, float[] stops)

Description

Creates a new gradient with the given colors distributed with a predefined array of stops.

Parameters

colorsThe colors of the gradient.
stopsThe array of stops to distribute for each color of the gradient.

Returns

GradientThe new gradient.