new Colormap( [colors] [, options])
Creates a new Colormap instance.
Parameters:
Name | Type | Argument | Default | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
colors |
Array.<Color> |
<optional> |
[black, white] | Array of colors to interpolate between |
||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Configuration options Properties
|
- Source:
Throws:
-
If colors/domain format is invalid
- Type
- Error
Methods
-
at(x)
-
Gets color for a value using configured interpolation type.
Parameters:
Name Type Description x
number Value to get color for
- Source:
Throws:
-
If interpolation type is invalid
- Type
- Error
Returns:
Corresponding color
- Type
- Color
-
rangeDomain()
-
Gets the domain range of the colormap.
- Source:
Returns:
Array containing [min, max] of domain
- Type
- Array.<number>
-
sample(maxSteps)
-
Samples the colormap into a buffer.
Parameters:
Name Type Description maxSteps
number Number of samples to generate
- Source:
Returns:
Sample data and buffer
- Type
- Object