CanvasGradient Class
A gradient of a canvas (https://html.spec.whatwg.org/multipage/canvas.html#canvasgradient): created by createLinearGradient(), createRadialGradient() and createConicGradient(), it is a fill or stroke style whose geometry is in the coordinates of the drawing operations that use it.
public sealed class CanvasGradientMethods
| Name | Description |
|---|---|
| AddColorStop(double, string) | Adds a color stop (https://html.spec.whatwg.org/multipage/canvas.html#dom-canvasgradient-addcolorstop): a stop at the same offset as existing stops is placed after them. |
AddColorStop(double, string)
CanvasGradient.csAdds a color stop (https://html.spec.whatwg.org/multipage/canvas.html#dom-canvasgradient-addcolorstop): a stop at the same offset as existing stops is placed after them.
Parameters
offsetdouble- The offset of the stop, from 0 to 1.
colorstring- A CSS color (
currentcoloris opaque black).
Exceptions
DomException- An
IndexSizeErrorwhen the offset is out of range, aSyntaxErrorwhen the color cannot be parsed.