CanvasGradient

CanvasGradient objects are created via canvas.createLinearGradient and canvas.createRadialGradient, and can be assigned to the canvas.fillStyle and canvas.strokeStyle properties.

They can be used to customize the canvas drawing operations using a gradient.

The gradient object can be further customized using addColorStop.

See also the CanvasGradient documentation at MDN.

gradient.addColorStop()(number, string) => void

Adds a new color stop, defined by an offset and a color.

offset number A number between 0 and 1 (inclusive), representing the position of the color stop.
color string A CSS color representing the color of the stop.

See also addColorStop at MDN.