RadialGradient

A radial gradient with two circles and color stops.

Constructor

new RadialGradient(f, c, r, color_stops)

Creates a new RadialGradient with the given focal point, center point, radius, and ColorStops.

Parameters:
NameTypeDescription
fPoint2D

The start circle center point of the gradient.

cPoint2D

The end circle center point of the gradient.

rnumber

The radius of the gradient.

color_stopsArray.<ColorStop>

The color stops of the gradient.

Classes

RadialGradient

Members

c

The end circle center point of the gradient.

c

The end circle center point of the gradient.

color_stops

Gets the ColorStops of the gradient.

color_stops

Sets the ColorStops of the gradient.

f

The start circle center point of the gradient.

f

The start circle center point of the gradient.

r

The radius of the gradient.

r

The radius of the gradient.

Methods

color_at(p) → {Color}

Gets the Color at a given point along the gradient.

Parameters:
NameTypeDescription
pPoint2D

The point to get the color at.

Returns:

The color at the given point.

Type: 
Color

color_at_offset(position) → {Color}

Gets the Color at a given offset along the gradient.

Parameters:
NameTypeDescription
positionnumber

The offset to get the color at.

Returns:

The color at the given offset.

Type: 
Color

(static) default_radial_gradient() → {RadialGradient}

Returns the default RadialGradient, which is a gradient from the focal point to the center with the same color.

Returns:

The default radial gradient.

Type: 
RadialGradient

(static) lerp(gradient1, gradient2, t) → {RadialGradient}

Linearly interpolates between two RadialGradients given a progress value.

Parameters:
NameTypeDescription
gradient1RadialGradient

The first radial gradient.

gradient2RadialGradient

The second radial gradient.

tnumber

The progress value.

Returns:

The interpolated radial gradient.

Type: 
RadialGradient

(static) single_color_gradient(f, c, r, color, repeatsopt) → {RadialGradient}

Returns a single color radial gradient.

Parameters:
NameTypeAttributesDescription
fPoint2D

The start circle center point of the gradient.

cPoint2D

The end circle center point of the gradient.

rnumber

The radius of the gradient.

colorColor

The color of the gradient.

repeatsnumber | null<optional>

Number of times to repeat the color.

Returns:

A single color radial gradient.

Type: 
RadialGradient