Class: Gradient

fabric.Gradient

new Gradient()

Gradient class
Source:
Tutorials:
See:

Members

offsetX :Number

Horizontal offset for aligning gradients coming from SVG when outside pathgroups
Type:
  • Number
Default Value:
  • 0
Source:

offsetY :Number

Vertical offset for aligning gradients coming from SVG when outside pathgroups
Type:
  • Number
Default Value:
  • 0
Source:

Methods

(static) forObject(obj, optionsopt)

Returns fabric.Gradient instance from its object representation
Parameters:
Name Type Attributes Description
obj Object
options Object <optional>
Options object
Source:

(static) fromElement(el, instance) → {fabric.Gradient}

Returns fabric.Gradient instance from an SVG element
Parameters:
Name Type Description
el SVGGradientElement SVG gradient element
instance fabric.Object
Source:
See:
Returns:
Gradient instance
Type
fabric.Gradient

addColorStop(colorStop) → {fabric.Gradient}

Adds another colorStop
Parameters:
Name Type Description
colorStop Object Object with offset and color
Source:
Returns:
thisArg
Type
fabric.Gradient

initialize(optionsopt) → {fabric.Gradient}

Constructor
Parameters:
Name Type Attributes Description
options Object <optional>
Options object with type, coords, gradientUnits and colorStops
Source:
Returns:
thisArg
Type
fabric.Gradient

toLive(ctx, object) → {CanvasGradient}

Returns an instance of CanvasGradient
Parameters:
Name Type Description
ctx CanvasRenderingContext2D Context to render on
object Object
Source:
Returns:
Type
CanvasGradient

toObject(propertiesToIncludeopt) → {Object}

Returns object representation of a gradient
Parameters:
Name Type Attributes Description
propertiesToInclude Array <optional>
Any properties that you might want to additionally include in the output
Source:
Returns:
Type
Object

toSVG(object) → {String}

Returns SVG representation of an gradient
Parameters:
Name Type Description
object Object Object to create a gradient for
Source:
Returns:
SVG representation of an gradient (linear/radial)
Type
String