# Two.Gradient
Extends: Two.Element
This is the base class for constructing different types of gradients with Two.js. The two common gradients are Two.LinearGradient and Two.RadialGradient.
# Constructor
Argument | Description |
---|---|
stops | A list of Two.Stops that contain the gradient fill pattern for the gradient. |
# renderer
Two.Gradient.renderer
Object access to store relevant renderer specific variables. Warning: manipulating this object can create unintended consequences.
# spread
Two.Gradient.spread
Indicates what happens if the gradient starts or ends inside the bounds of the target rectangle. Possible values are 'pad'
, 'reflect'
, and 'repeat'
.
See: https://www.w3.org/TR/SVG11/pservers.html#LinearGradientElementSpreadMethodAttribute (opens new window) for more information
# units
Two.Gradient.units
Indicates how coordinate values are interpreted by the renderer. Possible values are 'userSpaceOnUse'
and 'objectBoundingBox'
.
See: https://www.w3.org/TR/SVG11/pservers.html#RadialGradientElementGradientUnitsAttribute (opens new window) for more information
# clone
Two.Gradient.clone
Returns: Two.Gradient
Argument | Description |
---|---|
parent | The parent group or scene to add the clone to. |
Create a new instance of Two.Gradient with the same properties of the current path.
# toObject
Two.Gradient.toObject
Returns: Object
Return a JSON compatible plain object that represents the path.