JavaScript canvas2d object method: addColorStop()
[this page | pdf | back links]
The
addColorStop() method of the
JavaScript
DOM object returned
by the getContext("2d")
method applied to the HTML <canvas>
element specifies colours and stop positions for a gradient object, created by createLinearGradient()
or createRadialGradient().
You need to include at least one colour stop for a gradient to be visible.
It
has the following syntax with the following parameters.
gradient.addColorStop(stop, color)
|
Parameter
|
Required / Optional
|
Description
|
|
type
|
Required
|
A value between 0.0 and
1.0 identifying the position of the stop used in a gradient
|
|
color
|
Optional
|
Specified CSS colour to display at
the position of the stop
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)