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

# fromObject

Returns: Two.Gradient

Argument Description
obj Object notation of a Two.Gradient to create a new instance

Create a new Two.Gradient from an object notation of a Two.Gradient.

nota-bene

Works in conjunction with Two.Gradient.toObject

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

# copy

Argument Description
gradient The reference Two.Gradient

Copy the properties of one Two.Gradient onto another.

# toObject

Returns: Object

Return a JSON compatible plain object that represents the path.