Constructor
new Gradient(c1, c2, angleopt, cyclesopt)
Gradient constructor
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
c1 | string | The initial color, in any CSS-valid form. | ||
c2 | string | The final color, in any CSS-valid form. | ||
angle | number | <optional> | 0 | The inclination of the gradient relative to the horizontal line. |
cycles | number | <optional> | 1 | The number of times the gradient will be repeated. |
Members
angle :number
Tilt angle
- number
c1 :string
Initial color
- string
c2 :string
Final color
- string
cycles :number
Number of repetitions of the gradient
- number
Methods
getAttributes() → {object}
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
- The resulting object, with minimal attrributes
- Type:
- object
getCss() → {string}
Gets the CSS 'linear-gradient' expression of this Gradient
- A string ready to be used as a value for the
linear-gradient
CSS attribute
- Type:
- string
getGradient(ctx, rect) → {module:AWT.Gradient}
Creates a CanvasGradient
based on the provided context and rectangle.
Name | Type | Description |
---|---|---|
ctx | external:CanvasRenderingContext2D | The 2D rendering context |
rect | module:AWT. | The rectangle where this gradient will be applied to |
- Type:
- module:AWT.
Gradient
hasTransparency() → {boolean}
Checks if any of the gradient colors has transparency
true
if this gradient uses colors with transparency,false
otherwise.
- Type:
- boolean
setAttributes(data) → {module:AWT.Gradient}
Reads the properties of this Gradient from a data object
Name | Type | Description |
---|---|---|
data | object | The data object to be parsed |
- Type:
- module:AWT.
Gradient
setProperties($xml) → {module:AWT.Gradient}
Reads the properties of this Gradient from an XML element
Name | Type | Description |
---|---|---|
$xml | external:jQuery | The xml element to be parsed |
- Type:
- module:AWT.
Gradient