Constructor
new LinearGradient(p1, p2, color_stops)
Creates a new LinearGradient with the given start point, end point, and ColorStops.
Name | Type | Description |
---|---|---|
p1 | Point2D | The start point of the gradient. |
p2 | Point2D | The end point of the gradient. |
color_stops | Array.<ColorStop> | The color stops of the gradient. |
- Source
Classes
Members
color_stops
Gets the ColorStops of the gradient.
- Source
color_stops
Sets the ColorStops of the gradient.
- Source
p1
The start point of the gradient.
- Source
p1
The start point of the gradient.
- Source
p2
The end point of the gradient.
- Source
p2
The end point of the gradient.
- Source
Methods
color_at(p) → {Color}
Gets the Color at a given point along the gradient.
Name | Type | Description |
---|---|---|
p | Point2D | The point to get the color at. |
- Source
The color at the given point.
- Type:
- Color
color_at_offset(position) → {Color}
Gets the Color at a given offset along the gradient.
Name | Type | Description |
---|---|---|
position | number | The offset to get the color at. |
- Source
The color at the given offset.
- Type:
- Color
(static) default_linear_gradient() → {LinearGradient}
Returns the default LinearGradient, which is a gradient from the origin to the origin with no ColorStops.
- Source
The default linear gradient.
- Type:
- LinearGradient
(static) lerp(gradient1, gradient2, t) → {LinearGradient}
Linearly interpolates between two LinearGradients given a progress value.
Name | Type | Description |
---|---|---|
gradient1 | LinearGradient | The first linear gradient. |
gradient2 | LinearGradient | The second linear gradient. |
t | number | The progress value. |
- Source
The interpolated linear gradient.
- Type:
- LinearGradient
(static) single_color_gradient(p1, p2, color, repeatsopt) → {LinearGradient}
Returns the default LinearGradient, which is a gradient from the start to the end the same color.
Name | Type | Attributes | Description |
---|---|---|---|
p1 | Point2D | The start point of the gradient. | |
p2 | Point2D | The end point of the gradient. | |
color | Color | The color of the gradient. | |
repeats | number | | <optional> | Number of times to repeat the color. |
- Source
The default linear gradient.
- Type:
- LinearGradient