createLinearGradient method
The
CanvasRenderingContext2D.createLinearGradient()
method of the Canvas 2D API creates a gradient along the line connecting
two given
coordinates.

This method returns a linear CanvasGradient. To be applied to a shape, the gradient must first be assigned to the CanvasRenderingContext2D.fillStyle or CanvasRenderingContext2D.strokeStyle properties.
Note: Gradient coordinates are global, i.e., relative to the current coordinate space. When applied to a shape, the coordinates are NOT relative to the shape's coordinates.
Implementation
external CanvasGradient createLinearGradient(num x0, num y0, num x1, num y1);