W3cubDocs

/Haxe JavaScript

CanvasGradient

package js.html

Available on js

The CanvasGradient interface represents an opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient().

Documentation CanvasGradient by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Methods

addColorStop(offset:Float, color:String):Void

Adds a new stop, defined by an offset and a color, to the gradient. If the offset is not between 0 and 1 an INDEX_SIZE_ERR is raised, if the color can't be parsed as a CSS color, a SYNTAX_ERR is raised.

Throws:

null

DOMError

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/CanvasGradient.html