What are gradients in Canvas used for? What are their different types?

Asked: Apr 15, 2023

Gradients in canvas are used to fill rectangles, circles, lines etc.

The gradients in Canvas are of two types:

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

 

Asked by brijesh

Answers (0)

No answers yet. Be the first to answer!