Gradients in canvas are used to fill rectangles, circles, lines etc.
The gradients in Canvas are of two types:

- createLinearGradient(x,y,x1,y1) – It creates a linear gradient
- createRadialGradient(x,y,r,x1,y1,r1) – It creates a radial/circular gradient