web api interface
CanvasGradient
Available in workers
The CanvasGradient interface represents an opaque object describing a gradient. It is returned by the methods createLinearGradient(), createConicGradient() or createRadialGradient().
It can be used as a fillStyle or strokeStyle.
Instance properties
As an opaque object, there is no exposed property.
Instance methods
addColorStop()- : Adds a new stop, defined by an
offsetand acolor, to the gradient.
- : Adds a new stop, defined by an
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- Creator methods in
CanvasRenderingContext2D. - The
<canvas>element and its associated interface,HTMLCanvasElement.