# 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.

# Properties

A list of properties that are on every Two.Gradient.

# renderer

Object access to store relevant renderer specific variables. Warning: manipulating this object can create unintended consequences.

nota-bene

With the Two.SVGRenderer you can access the underlying SVG element created via shape.renderer.elem.

# id

Session specific unique identifier.

nota-bene

In the Two.SVGRenderer change this to change the underlying SVG element's id too.

# spread

Indicates what happens if the gradient starts or ends inside the bounds of the target rectangle. Possible values are 'pad', 'reflect', and 'repeat'.

# units

Indicates how coordinate values are interpreted by the renderer. Possible values are 'userSpaceOnUse' and 'objectBoundingBox'.

# stops

An ordered list of Two.Stops for rendering the 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

Returns: Object

Return a JSON compatible plain object that represents the path.