CanvasGradient
The CanvasGradient interface represents an opaque object describing a gradient. It is returned by Canvas.createLinearGradient() or Canvas.createRadialGradient().
It can be assigned to fillStyle or strokeStyle.
Methods
addColorStop(offset, color)
Adds a new color stop, defined by an offset and a color, to a given canvas gradient. See MDN web docs for full details.
Parameters
| Name | Type | Description |
|---|---|---|
offset | Number | A number between 0 and 1 representing the position of the color stop. |
color | String | A CSS color value. |