Constructor
new ColorGradient(values, snap)
Create a new ColorGradient.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
values | Object.<number, Color> | Initial values of gradient | |
snap | boolean | false | (Optional) Whether the get() function should return interpolated values between the colors (false), or snap to the color at the closest lower point (true). Set to false by default. |
Methods
get(point) → {Color}
Get the color on the gradient at a specified point.
Parameters:
Name | Type | Description |
---|---|---|
point | number | Point along the gradient (0-1) |
Returns:
Resulting color at the specified point along the gradient
- Type:
- Color
set(point, color)
Set a Color at a point
Parameters:
Name | Type | Description |
---|---|---|
point | number | Point to set the color at (0-1) |
color | Color | Color to set at the point |