Gradients
In this chapter you will learn:
Set gradients
We can set the fill and stroke styles using gradients. The canvas element supports two kinds of gradients: linear and radial.
Name | Description | Returns |
---|---|---|
createLinearGradient(x0, y0, x1, y1) | Creates a linear gradient | CanvasGradient |
createRadialGradient(x0, y0, r0, x1, y1, r1) | Creates a radial gradient | CanvasGradient |
CanvasGradient object defines the method shown in the following table:
Name | Description | Returns |
---|---|---|
addColorStop(position, color) | Adds a solid color to the gradient line | void |
Next chapter...
What you will learn in the next chapter:
Home » Javascript Tutorial » Canvas